Check out https://git.sdf.org/peteyboy/ssg-for-sdf
ssg-for-sdf is an SDF-ready fork of ssg5, a static site generator written in shell, from https://www.romanzolotarev.com/ssg.html
It creates a static site from a set of markdown and/or html files, so you can start with say, an existing HTML site and migrate it over time to Markdown and ssg5.
From the author:
ssg is a static site generator written in shell. Optionally it converts Markdown files to HTML with lowdown(1) or Markdown.pl.
(note: Markdown.pl is installed on SDF cluster as of this writing, so that's what it will use)
Unless a page has <HTML> tag ssg5 extracts its title from <H1> tag, wraps the page with _header.html, _footer.html.
Then copies everything (excluding .* or paths listed in src/.ssgignore) from src to dst directory.
Markdown and HTML files
HTML files from src have greater priority than Markdown ones. ssg5 converts Markdown files from src to HTML in dst and then copies HTML files from src to dst. In the following example src/a.html wins:
src/a.md → dst/a.html
src/a.html → dst/a.html
So the cool thing is, you can slowly migrate your static site to ssg, because if you already have an html file in source, it just copies it straight to dest, without requiring a Markdown version to exist already. So you can have a set of files in your source folder that are some *.md files, and some *.html files, and they will all get generated into the site.
change dirs to a folder that you keep projects in (
~/projects, say), the clone the ssg-for-sdf repo:
$git clone https://git.sdf.org/peteyboy/ssg-for-sdf.git
mkdir ~/bin(and add it to your $PATH)
binfolder, and make it executable by you
$cp ssg5 ~/bin $chmod u+x ~/bin/ssg5
~/htmlfolder, you can make
~/html_destand simply delete the contents of ~/html and copy ~/html_dest into it when you are satisfied; alternately, you can just drop the results straight into your live html or public_html folder.
If you want consistent headers or footers, just
$ echo '<html><title></title><body>' > src/_header.html
$ echo '</body></html>' > ~/html_source/_footer.html
You can copy whatever you already have in
~/public_html (for your tilde site), into your
Ah, the easy part! Just write your musings in any text editor using the Markdown Syntax. You don't need to have any HTML but either of the two optional “H1” markdown tags at the top of your markdown file if you want a title filled in using the
_header.html file trick of making an empty <TITLE></TITLE> tag, as above:
My Title =======
# My title
If you just run
ssg5 with no arguments and it will give you its usage:
$ ~/bin/ssg5 usage: ssg5 src dst title base_url
Assuming you've added
~/bin to your path, simply run something like:
ssg5 ~/html_source ~/html_dest 'Test' 'https://<YOUR WEBSITE URL>'
If you used the minimal
_footer.html as described above, your page Titles will be of the form Whatever the H1 is in your Markdown - The Title you fed to the ssg5 command, like so:
<html><title>This is my index file — Test</title> <h1>This is my index file</h1> ...
ssg5 for my tilde pages, so I run:
ssg5 ~/html_source ~/public_html “Peteyboy's tilde site” https://freeshell.org/~peteyboy
After you generate your site, run
mkhomepg -p to fix any permissions for new pages
roman zolotarev has a watch executable that will monitor and refresh your site on any changes, and more details. Definitely check out his page: https://www.romanzolotarev.com/ssg.html