A template to build static websites with Pandoc.
Demo site: pandoc.merose.com.
bin/build
walks the source directory, invokes Pandoc on each file, and copies assets to a destination folder. It also
gathers all files not named "index.md" into an RSS feed.
This tool is configurable by environment variables.
Variable | Description | Default |
---|---|---|
SRC |
Root directory of input sources. | src/ |
DST |
Root directory for generated output. | public/ |
ASSETS |
Directory for static assets, like CSS and images | assets/ |
SRC_EXT |
Input sources file extension. | md |
DST_EXT |
Output generation file extension. | html |
HEADER |
path/to/header.html (--include-before-body ). |
template/header.html |
FOOTER |
path/to/footer.html (--include-after-body ). |
template/footer.html |
CSS |
path/to/style.css embedded in header of a web page. | /assets/css/main.css |
PANOPTS |
Arguments to pass to Pandoc for each input file. | --css $CSS --metadata-file=$ROOT/defaults.yml -B $HEADER -A $FOOTER" -V lang=en-US |
To make it easier to edit metadata for every page, consider making changes to the defaults.yml
at the project root.
Note: Configuring RSS still needs to happen in the
bin/build
file today.
The defaults of this script are oriented for creating static websites. However, the configuration could be molded to support a wide variety of tasks; for instance, generating a CV or a slide deck. See these examples for more inspiration.
bin/watch
will watch the source directory. On any changes, it will invoke the build script.
Note: if you change files outside of
$SRC
(i.e. intemplate/
orassets/
), you'll need to terminate and re-run this script.
This template will publish the static site to Github Pages via Github Actions.
- The contributors of Pandoc
- Will Styler's inspiration
- Pure sh Bible
- Drew McConville