a_simple_static_site_generator
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
a_simple_static_site_generator [2021/04/09 22:22] – [Copy to your personal bid directory] fix typo peteyboy | a_simple_static_site_generator [2023/02/23 20:15] (current) – added explanation peteyboy | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== SSG5: A simple static site generator====== | ||
+ | Check out https:// | ||
+ | |||
+ | // | ||
+ | |||
+ | 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) | ||
+ | |||
+ | ==== How it Works ==== | ||
+ | > Unless a page has < | ||
+ | > Then copies everything (excluding .* or paths listed in src/ | ||
+ | |||
+ | |||
+ | > | ||
+ | > | ||
+ | >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: | ||
+ | > | ||
+ | > | ||
+ | > | ||
+ | |||
+ | |||
+ | So simple! | ||
+ | |||
+ | 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. | ||
+ | |||
+ | |||
+ | ===== Clone Git Repo ===== | ||
+ | change dirs to a folder that you keep projects in ('' | ||
+ | $git clone https:// | ||
+ | |||
+ | ===== Copy to your personal bin directory ===== | ||
+ | * Make sure you have a ~/bin folder. | ||
+ | * copy the ssg5 executable file to the '' | ||
+ | |||
+ | $cp ssg5 ~/bin | ||
+ | $chmod u+x ~/bin/ssg5 | ||
+ | |||
+ | ===== Set Up src and dest ===== | ||
+ | * You can create a source folder, named whatever, let's say '' | ||
+ | * If you want to make sure things look right, you can make a destination folder that is not your '' | ||
+ | |||
+ | ===== Set up Header and Footer ===== | ||
+ | If you want consistent headers or footers, just | ||
+ | |||
+ | * If your site has or wants a favicon, put it as // | ||
+ | * Put something you want at the beginning of each file (css, < | ||
+ | * At minimum, you want a HTML and title tag, the blank Title will get filled by H1 of your Markdown doc | ||
+ | * '' | ||
+ | * Put something you want at the end of each file into '' | ||
+ | * At minimum, you want closing /BODY and /HTML tag | ||
+ | * '' | ||
+ | * Exclude any paths in '' | ||
+ | |||
+ | ===== Put any existing HTML files into Source folder ===== | ||
+ | You can copy whatever you already have in '' | ||
+ | |||
+ | ===== Start Writing Markdown ===== | ||
+ | Ah, the easy part! Just write your musings in any text editor using the [[ https:// | ||
+ | |||
+ | < | ||
+ | My Title | ||
+ | ======= | ||
+ | </ | ||
+ | |||
+ | or | ||
+ | |||
+ | < | ||
+ | # My title | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Running SSG5 ===== | ||
+ | |||
+ | If you just run '' | ||
+ | |||
+ | $ ~/bin/ssg5 | ||
+ | usage: ssg5 src dst title base_url | ||
+ | |||
+ | Assuming you've added '' | ||
+ | |||
+ | ssg5 ~/ | ||
+ | |||
+ | |||
+ | If you used the minimal '' | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | |||
+ | I use the'' | ||
+ | '' | ||
+ | |||
+ | **After you generate your site, run '' | ||
+ | mkhomepg -p | ||
+ | |||
+ | ===== Fancy Stuff ===== | ||
+ | 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:// | ||
+ | |||
+ | |||
+ | |