Static site generation

13 February 2019   PDF version

  • Most of the time, we can write content for our site in a simpler format than HTML+CSS.
  • Then we could convert that format to HTML, and surround it with a template.
  • Example: if site is a food blog. There may be 3 types of pages:
    1. Recipe page (instructions, pics)
    2. Travelogue page (location, pics)
    3. About page (text)
  • Create HTML templates for those 3 types of pages,
  • Write most of the content in Markdown format.
  • Run a tool to convert markdown into HTML and embed in the template.
  • Good technique for consistency, simplicity.

There are many tools that do this. Here are a few:

See for an example that uses pandoc and a Makefile. From the markdown folder, you would run make to update the HTML files as needed, or make -B if you want to force everything to rebuild.