|
| 1 | +# Pandoc Website Template |
| 2 | + |
| 3 | +[](https://github.com/alxmrs/pandoc-website-template/actions/workflows/pages.yml) |
| 4 | +[](https://github.com/alxmrs/pandoc-website-template/actions/workflows/shellcheck.yml) |
| 5 | + |
| 6 | +A template to build static websites with [Pandoc](https://pandoc.org/). |
| 7 | + |
| 8 | +Demo site: [pandoc.merose.com](https://pandoc.merose.com/). |
| 9 | + |
| 10 | +## Use |
| 11 | + |
| 12 | +### `build` |
| 13 | + |
| 14 | +`bin/build` walks the source directory, invokes Pandoc on each file, and copies assets to a destination folder. It also |
| 15 | +gathers all files not named "index.md" into an RSS feed. |
| 16 | + |
| 17 | +This tool is configurable by environment variables. |
| 18 | + |
| 19 | +| Variable | Description | Default | |
| 20 | +|-----------|-----------------------------------------------------|--------------------------------------------------------------------------------------| |
| 21 | +| `SRC` | Root directory of input sources. | `src/` | |
| 22 | +| `DST` | Root directory for generated output. | `public/` | |
| 23 | +| `ASSETS` | Directory for static assets, like CSS and images | `assets/` | |
| 24 | +| `SRC_EXT` | Input sources file extension. | `md` | |
| 25 | +| `DST_EXT` | Output generation file extension. | `html` | |
| 26 | +| `HEADER` | path/to/header.html (`--include-before-body`). | `template/header.html` | |
| 27 | +| `FOOTER` | path/to/footer.html (`--include-after-body`). | `template/footer.html` | |
| 28 | +| `CSS` | path/to/style.css embedded in header of a web page. | `/assets/css/main.css` | |
| 29 | +| `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` | |
| 30 | + |
| 31 | +To make it easier to edit metadata for every page, consider making changes to the `defaults.yml` at the project root. |
| 32 | + |
| 33 | +> Note: Configuring RSS still needs to happen in the `bin/build` file today. |
| 34 | +
|
| 35 | +The defaults of this script are oriented for creating static websites. However, the configuration could be molded to |
| 36 | +support a wide variety of tasks; for instance, generating a CV or a slide deck. See [these examples](https://pandoc.org/demos.html) |
| 37 | +for more inspiration. |
| 38 | + |
| 39 | + |
| 40 | +### `watch` |
| 41 | + |
| 42 | +`bin/watch` will watch the source directory. On any changes, it will invoke the build script. |
| 43 | + |
| 44 | +> Note: if you change files outside of `$SRC` (i.e. in `template/` or `assets/`), you'll need to terminate and |
| 45 | +> re-run this script. |
| 46 | +
|
| 47 | +### Deployment |
| 48 | + |
| 49 | +This template will publish the static site to [Github Pages](https://pages.github.com) via [Github Actions](http://github.com/actions). |
| 50 | + |
| 51 | + |
| 52 | +## Thanks to |
| 53 | + |
| 54 | +- The [contributors of Pandoc](https://github.com/jgm/pandoc/graphs/contributors) |
| 55 | +- Will Styler's [inspiration](http://wstyler.ucsd.edu/posts/lmimg/spcv.txt) |
| 56 | +- [Pure sh Bible](https://github.com/dylanaraps/pure-sh-bible) |
| 57 | +- [Drew McConville](http://bettermotherfuckingwebsite.com/) |
0 commit comments