Tools to streamline the publishing of static web content.
- Minimize external dependencies.
- Leverage available tools to the greatest extent possible: sed, awk, grep, sort, Make, shell
- Don't use python. Too slow for my taste.
- Transcend the limitations of the simpler tools such as saait, sw, ssg5 (from which this is partially derived), and yet avoid the complexity of Pelican.
- Develop plain html or markdown content. Uses lowdown to compile the markdown.
- Leverage the markdown metadata to populate your pages, with or without the yaml surrounding delimiters.
- Global header and footer templates for all content.
- Generate indexed content from special header/footer/body templates, respecting the above global header and footer. The index templates, similarly, support site and metadata originating variables. (Inspired by saait.) Examples:
- Dated index/archive pages.
- Sitemap
- RSS feed
- Category-based indexes
- twtxt feed
- Populate the RSS description field with the metadata summary or the first html paragraph
- In the header template, leverage metadata fields as well as the site configured variables.
- Support for conditional sections in the header template.
- Transform all
.../page.md
markdown content to a format.../page/index.html
. Respect all other naming convention and the flexibility of any web directory hierarchy. - Allow symbolically linked content in the source directory.
- Only build new or updated content.
- lowdown
- cpio
- Make
- gawk, if extracting summaries for rss feed generation
-
Pick a directory for your project. You will execute all the below commands from here.
-
Create a subdirectory
web
. Place your markdown, html bodies,_header.html
,_footer.html
here. -
Create a subdirectory
web-prod
. Your compiled and production content will go here. -
Create a subdirectory
templates
for any index templates you may want. See below -
Place
.ssg_config
in the project directory with minimally the following variables defined:SITE_TITLE="My site" FEED_RSS=/feeds/rss.xml
Generate a CSV of all html/markdown content in the appropriate format. Read the appropriate metadata tags for markdown content. Modify the generated all-content.csv
appropriately if missing certain metadata. Feel free to amend or modify the file, but if you choose to rerun the following command, your changes will be overwritten.
idxgen -c web > all-content.csv
idxgen -x all-content.csv web/index.html templates/index.html
Generate a sitemap:
idxgen -x all-content.csv web/sitemap.xml templates/sitemap.xml
Compile your static content as well as any indexes from above. This converts all markdown to html and joins the appropriate headers/footers.
ssg5 web web-prod "My site" "https://ntmlabs.com"
-
Insure your production (compiled) content already exists in
$PROD_OUT
. -
Assert the following variables in
.ssg_config
, needed for a complete RSS.SITE_TITLE="My site" FEED_RSS=/feeds/rss.xml PROD_OUT=web-prod PROD_BASE_URL="https://ntmlabs.com"
-
Make sure the
templates
folder containsrss.xml
,rss.hdr
andrss.ftr
. -
Execute the following:
idxgen -x all-content.csv web-prod/feeds/rss.xml templates/feeds/rss.xml
The examples
subfolder contains a Makefile useful to automate the build process. This requires a more complete configuration set:
SITE_TITLE="My site"
INPUTDIR=web
DEV_OUT=web-dev
PROD_OUT=web-prod
TEMPLATE_DIR=templates
URL_LIST=all_content.csv
FEED_RSS=/feeds/rss.xml
DEV_BASE_URL="http://localhost:8080"
PROD_BASE_URL="https://mysite.com"
- Run
make
to generate the URL_LIST, build all the templates and compile a local website in DEV_OUT. - Run
make prod
to similarly build the production version in PROD_OUT - Run
make prod_rss
to produce the RSS feed - Optional: if S3_BUCKET is defined (see below), execute
make s3_upload
to sync the PROD_OUT folder with the appropriate Amazon S3 bucket.
FAV_ICON=icon.png
SHORT_INDEXES=index.html # index template that produces only the latest 10 posts
HEADER="web/_custom-hdr.html"
FOOTER="web/_custom-ftr.html"
# Set to the Amazon S3 bucket hosting your web content, *excluding* the s3:// portion. Comment out to omit the Makefile S3 uploading logic.
S3_BUCKET=