Generate a (mostly) Markdown-powered blog. Source files are stored in Markdown, to be rendered on the fly by a web server like Caddy.
In order to generate valid XML for RSS 2.0 feeds,
pandoc is required to convert the Markdown to HTML for inclusion in the output feed file.
- GNU date (
brew install coreutilson OSX)
- GNU sed (
brew install gnu-sedon OSX)
- pandoc (
brew install pandocon OSX)
A config file is mandatory. Copy the provided
config and edit appropriately.
SRC is the directory in which new content will be found for processing.
DOCROOT is the root directory for your website. All output files will be created here. No trailing slash.
URL is the full URL of your site. No trailing slash.
DESCRIPTION is the text to supply to the
<description> element in the RSS feed(s).
HOMECOUNT is the number of items to display on the home page.
RSSCOUNT is the number of items to display in the RSS feed.
You may define custom functions inside the config file to alter the execution of some parts of this script.
FILTER_FUNC will run on the input Markdown file(s) before
blog.sh does anything else. This is a good place to do any content sanitization that you might need.
ARCHIVE_FUNC will be invoked when building the archive list of all content. By default,
blog.sh will create a full list of all content. You can override this in your own function.
HOME_FUNC will run to generate the home page. By default,
blog.sh will create a list of
HOMECOUNT items, newest first.
blog.sh requires a command line argument to tell it what config file to use. If no option is provided, it will look for a file named
config in the current working directory. If none is found, the script will exit with an error.
In addition to the output files created in
DOCROOT, this script will create a file named
permalinks.txt that contains a complete list of all permalinks for content processed by
How I use this
I use the iOS Shortcuts application on my iPhone and iPad to take input from me, prompt for an opitonal image, upload all of that to my server, then invoke
blog.sh via SSH.