~arjca/mastaba

feat: generate sitemap.xml
feat: generate HTML from Markdown
docs: initialize README.md

refs

dev
browse  log 

clone

read-only
https://git.sr.ht/~arjca/mastaba
read/write
git@git.sr.ht:~arjca/mastaba

You can also use your local clone with git send-email.

#Mastaba -- a (much) simpler static website generator

Mastaba is a (very (very)) simple static website generator.

No dark magic:

  1. Write a HTML layout for your pages
  2. Write the content of your pages in Markdown
  3. Run mastaba: your webpages are (already) ready

#How does it work?

To use mastaba, you need two elements: a layout and a content directory.

#Layout

A layout is a templated HTML file.

It will be processed by the template/html package of the Go standard library. Consequently, you should use the adequate templating language. Also, anything you can do with this package, you can do it in the layout.

mastaba inject two values in the layout:

  • {{ .Content }} is the content of a Markdown file which has been translated into HTML
  • {{ .Metadata }} is a map containing all the fields in the front matter of the Markdown document. You can add as many field as you like. To use these values, you will write: {{ index .Metadata "name_of_my_key" }}

#Content directory

This folder contains all the content of your website. Everything will be copied as-is, except for the Markdown files that will be translated to HTML.

This translation includes:

  • Translating the content of the files to use HTML markups
  • Changing relative links when it refers to a Markdown file: for instance, [link](./file.md) will be translated to <a href="./file.html">link</a>

#Installation

go install git.sr.ht/~arjca/mastaba/cmd/mastaba@latest

#Usage

mastaba has several arguments:

  • --layout (optional): the path to the HTML template (default is layout.html)
  • --input (optional): the path to the content directory (default is content/)
  • --output (optional): the path to the site directory (default is _site)
  • --host (required): the base URL of the website