~arjca/kourou

A (much) simpler static website generator
chore: big bang migration on Git

refs

dev
browse  log 

clone

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

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

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

Kourou is a (most) simpler static website generator.

No dark magic:

  1. Write HTML layouts for your pages
  2. Write the content of your pages in Markdown
  3. Run kourou: it generates your webpages!

#Motivation

I was looking for a static website generator, for my personal website. My requirements: nothing complicated. All I wanted was:

  • Have my files where I want them;
  • Save time by not rewriting/maintaining the HTML layout of my pages;
  • (optional) Use a simpler format for content, such as Markdown.

However, I found that the popular open source generators were much more advanced than I needed, and that their developers had made decisions that went against my requirements.

Therefore, I developped that little piece of software. :-)

#Get started

#Install kourou

Simply use go install :

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

#Initialize files

No init command here. In the current folder, kourou expects two directories:

  • One with the HTML layouts. Its default name is layouts/;
  • One with all the website content. Files can be any format; only Markdown files (for now!) can be converted to HTML. Its default name is contents/.

See the samples directory for examples.

#Contents

The contents/ folder contains all your website documents.

Markdown documents may be translated to HTML. To do this, you need to declare a YAML front matter with the layout field. For instance, if the layout for index.md is main-layout, then the content index.md can be:

---
layout: main-layout
---
My awesome page!

kourou will then generate the appropriate index.html, using both the layout and the content of index.md.

#Layouts

Layouts are .html files used as templates by the template/html package of the Go standard library. Consequently, anything you can do with this package, you can do here.

Two variables are available in templates:

  • {{ .Content }} is the content of a Markdown file, translated into HTML;
  • {{ .Metadata }} is a map containing all the fields in the Markdown document's front matter. You are free to add as many field as you like. For instance, to print the layout's name in the page, you would write {{ index .Metadata "layout" }} .

#Generate website

Once your files are ready, simply type (in your terminal, in the directory containing layouts/ and contents/):

kourou [--contents contents/ --layouts layouts/ --output _site/ --layout-field layout]

All generated files can be found in _site/.

The options (between [...]) can be used to change the name of the directories and the field checked in Markdown front matters for selecting a layout.