Skip to content

A proper static file compiler #17

@badlydrawnrob

Description

@badlydrawnrob

A quick fix for now (compile posts and write /words links page by hand)
Eventually you might want dynamic sections, asides, and so on (use Zola or 11ty)
See issue #5 for a fully-fledged static site builder (but perhaps YAGNI)

Current compiler problems

  1. The Ozaria page gets messy (mixing Markdown and html)
  2. Dynamic content is harder to add (where Elm lang would be useful)
  3. Project folders aren't the best laid out (try and simplify wherever possible)

Compiling with Pandoc

Compiling every single file is annoying with Pandoc, so you can use a bash script:

for file in ./source/*.md; do
    pandoc --template=./source/pandoc-template.html -c ../static/styles.css -s "$file" -o "./build/$(basename "$file" .md).html";
done

For the sitemap here's a good start (" quotes are optional for spaces in filename). You'd also need to read the file YAML data and output title (instead of $filename). Use Python or Elm?

for file in *.html; do
  filename="$(basename "$file" .html)";
  echo "<li><a href=\"$filename\">$filename</a></li>";
done

You can also concatenate multiple files with

pandoc --template=./source/pandoc-template.html --css=./static/styles.css ./partials/*.md ./partials/metadata.yaml -s -o ./build/output.html

Pandoc is fine, but trying to use it to compile multiple blog files seems to call for code that I don't really understand. Might be best to find a simple tool that I don't have to think about, with better template language than Pandoc.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions