diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 24 |
1 files changed, 17 insertions, 7 deletions
@@ -1,16 +1,17 @@ # ssg-blog -This is a modification to the simple static site generator '[ssg](https://romanzolotarev.com/bin/ssg)' by Roman Zolotarev. This generates a minimal blog index page with category headings. +This is a modification to the simple static site generator '[ssg](https://romanzolotarev.com/bin/ssg)' by Roman Zolotarev. This generates a minimal blog index page with category headings and posts sorted by date using YAML frontmatter in markdown files. + + # Install / Usage See [https://romansolotarev.com/ssg.html](https://romanzolotarev.com/ssg.html) for documentation on ssg -In short: 1. Install [lowdown](https://kristaps.bsd.lv/lowdown/) -2. Copy the `ssg` script somewhere in your path, e.g. `/usr/bin/` -3. `chmod +x /usr/bin/ssg` -4. `ssg src dst 'my-website-name' 'https://my-website.net'` +2. Copy the `ssg-blog` script somewhere in your path, e.g. `/usr/bin/` +3. `chmod +x /usr/bin/ssg-blog` +4. `ssg-blog src dst 'https://my-website.net'` ssg-blog checks for subdirectories in the src directory, each of which becomes a category heading (non-recursively). It will generate a sorted list of links to any .md file in those directory (including nested directories). Each .md file needs frontmatter including the title and a YYYY-MM-DD date like this to be included in the index page: @@ -23,12 +24,17 @@ date: 2024-10-09 ## Example -There is an example directory in this repo to show you how to set up the files (src) and what the output looks like (dst). Note how articles can be nested in subdirectories or not and that the articles titled index.md get links created without .html appended. This was the command used to generate the example output: +There is an example directory in this repo to show you how to set up the files (src) and what the output looks like (dst). This was the command used to generate the example output: ``` -./ssg-blog example/src example/dst 'example-site-name' 'https://example.org' +./ssg-blog example/src example/dst 'https://example.org' ``` +Note a few things about the output: +1. Markdown files can be nested in subdirectories or not. +2. Files named index.md will get have a link generated without <filename>.html at the end. +3. Files outside subdirectories (e.g. about.md) will be rendered but won't show up on the index. + ## Change how categories are sorted The category headings are sorted alphabetically. If you want to change this, you have to edit the `sort` on this line: @@ -37,6 +43,10 @@ The category headings are sorted alphabetically. If you want to change this, you find "$src" -mindepth 1 -maxdepth 1 -type d ! -path "*/.*" | sort | ``` +# Differences from ssg + +The title argument from ssg is unnecessary so I've removed it. `render_html_file` used it to modify the first <h1> tag and auto-populate the <title> if none is specified, which is functionality I've never needed. Now `render_html_file` just outputs the header file, output from lowdown, then the footer file with no modifications. + # Alternatives You might also be interested in the similar fork [fmash16/ssg5](https://github.com/fmash16/ssg5) which generates a more traditional blog with pagination, keywords, and post previews. |
