Static site generation
- 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
- Recipe page (instructions, pics)
- Travelogue page (location, pics)
- 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:
- Jekyll – the tool used by GitHub Pages.
- pandoc (installed in the VM) is a universal document converter that can be used for Markdown → HTML.
See gitlab.liu.edu/cs120s19/cs120pub/tree/master/markdown for an
example that uses
pandoc and a
Makefile. From the
folder, you would run
make to update the HTML files as needed, or
make -B if you want to force everything to rebuild.