A simple static site generator that uses pandoc for most of the work, written in bash, forked from https://gitlab.com/uoou/blop
Go to file
Drew ed180dfbcb config 2019-10-01 15:13:10 +01:00
LICENSE blop 2019-09-26 06:26:09 +01:00
README.md config 2019-10-01 15:13:10 +01:00
blop /home/drew/.config/ 2019-10-01 14:40:59 +01:00
blop_logo.png archive 2019-09-30 14:24:25 +01:00

README.md

Very simple bash based static site generator with absolutely no features at all. Only real dependency is pandoc.

Demo blog and repo for that blog so you can see what's what.

Installation

Clone the repo and copy the script wherever you like it, curl it, copy and paste. Whatever you fancy, it's a bash script.

Usage

Run it in the directory where you want your blog to live then upload/push the resulting html to wherever you like.

It expects the following things:

markdown/

A directory called markdown which contains the markdown files that will be turned into html blog posts.

index_template.html

This is the file the blog's index.html will be built from. Put whatever html you like in here. The post listing will replace the <!--post-list--> html comment in this file. You can rejig what gets listed in an option near the top of the blop script itself.

post_template.html

Similar to the index template, this is the basis for individual blog posts. The following html comments will be replaced with what you'd expect: <!--title-->, <!--author-->, <!--date--> and <!--post-->.

archive_template.html

This is the basis of archive.html which is where posts beyond the $max_posts variable in the script will be put. $max_posts can be set to "unlimited". The archive list will replace the <!--archive list--> comment in this file.

The rest you can do with as you wish - write as much or as little html as you like, CSS it up, include javascript and images and videos and whatnots.

rss_template.xml

This is the template for the RSS feed. What a surprise. Fiddle as you like. <!--url--> will be replaced by the site's base url (taken from url.txt) and <!--rss---> will be replaced with the rss items (i.e. your blog post contents).

url.txt

This file should contain the url of your blog's root, without a trailing slash. This is used to provide the absolute links in the RSS feed.

There are a few variables you can set at the top of the script, they should be self-explanatory (and are commented). Preferably, use a per-site config file (see below).

There are examples for all of these files over at the demo blog.

The blog post's title (which is derrived from the filename of the markdown) and author (which defaults to the value at the top of the blop script) can, either or both, be overridden on a per-post basis by putting information at the top of the markdown file in the following form (including dashes):

---
author: Someone
title: Some Title
---

The rest you can do with as you like. Put whatever static html you want in the root and link to it from other pages, add an images folder, lots of CSS, videos, under-construction animated gifs...

Each time blop is run it will delete all the html files in the posts directory (so don't put any other static content in there, make a separate directory or put it in the root), the index.html file and rss.xml. It won't touch anything else.

Per-site config

You can create a file called site.conf in the blog's root directory to override default settings. Format is yamlish, i.e.:

max_posts: 20
short_date_format: %Y
default_author: Rebecca Black

Settings are:

Setting Description
default_author Unless specified in the blog's markdown file, this will be the author
max_posts How many posts to list in the index.html. Set to unlimited to list all posts
group_by_date Whether to insert date-grouping headers in the index listing as in the archive. Set to true or false
date_format The format to use for dates on blog entires
short_date_format The date format to use when grouping by date
listing_format The format to use in post listings. <!--title-->, <!--author--> and <!--date--> will be replaced with what you'd expect and <!--title-nospaces--> equates to the generated html file's basename, to be used in links

Note that setting values should be unquoted.

As with the rest, there's an example of this in the demo blog.