etisbew

command module
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2023 License: MIT Imports: 13 Imported by: 0

README

Etisbew

A simple and opinionated static site generator.

Input directory structure:

yoursite/
├╴templates/
│ └╴default.html
├╴blog/
│ └╴my-article.md
├╴horses/
│ └╴american-standardbred.md
├╴index.md
└╴about.md

Output structure:

yoursite/
└╴output/
  ├╴blog/
  │ └╴my-article/index.html
  ├╴horses/
  │ └╴american-standardbred/index.html
  ├╴index.html
  └╴about/index.html

Input files can be either plain markdown or contain an INI header delimited with ~~~, but they must use the .md extension:

index.md
~~~
Title = Welcome
Template = custom.html
~~~

Regular markdown goes here

Valid keys in the header are Title, Body, and Template (default value default.html). If you specify Body in the header it will override the contents of the markdown. Not sure why that would be useful, but it's how I wrote the input parser. :)

Templates use go's html/template package. Only a default.html template is required, but all templates must be in the templates directory and use the .html extention.

templates/default.html
<!doctype html>
<meta charset="utf-8">
<title>{{.Title}}</title>

<body>
  {{if .Title}}
  <h2>{{.Title}}</h2>
  {{end}}

  {{.Body}}
</body>

And that's pretty much it.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL