ssg08 0.2.6

A simple static site generator
ssg08-0.2.6 is not a library.

ssg08

A static site generator, configured via templates.

Installation

cargo install ssg08

See ssg08 --help for usage information.

Overview

Each file of the input tree is copied to a file in the same position of the output tree. Markdown files are converted to HTML, and files with a like-named folder (ex. posts.md and posts/) will have a feed of the folder's Markdown files appended to their contents.

Markdown

The parsed dialect of Markdown is CommonMark, with the following extensions.

  • Tables
  • Footnotes
  • Strikethrough
  • Tasklists
  • Smart punctuation
  • Math (LaTeX will be tagged, but is not expanded)
  • Superscript
  • Subscript

See the pulldown_cmark documentation for more information.

Templates

ssg08 takes three template parameters to base HTML generation upon. The following expansions are parsed.

Expansion Function
{{title}} The page's file basename, with hyphens and the extension stripped.
{{date}} The last-modified date of the page file.
{{navigation}} A navigation bar generated from the site's top-level pages.
{{content}} The HTML content of the page, excluding feeds.
{{feed}} Post feeds generated from like-named subtrees.
{{link}} An absolute link to the page.
  • The page layout template (--page) accepts all expansions.
  • The post layout template (--post) accepts {{title}}, {{date}}, and {{link}}.
  • The navbar layout template (--nav) accepts {{title}} and {{date}}.

A page layout example:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="date" content="{{date}}">
  <link href="/main.css" rel="stylesheet" type="text/css" media="all">
  <title>{{title}}</title>
</head>
<body>
  <nav>{{nav}}</nav>
  <h2>{{title}}</h2>
  <div class="content">{{content}}</div>
  <div class="feed">{{feed}}</div>
</body>
</html>

A post layout example:

<a href="/{{link}}">{{title}}</a>{{date}}

A navbar layout example:

<a href="/{{link}}">{{title}}</a>

Limitations

  • As titles are determined via filename, the index page must have index as its title.