site 0.2.0

A simple, fast, opinioned static site generator
Documentation

Site

build crates.io

Site is a fast, simple, and opinioned static site generator, written in Rust. Highlights include:

  • Write your content in Markdown format. Site is using pulldown_cmark as a markdown parser with extensions.
  • Uses Jinja2 as a template language. Site is using tera template engine.
  • Very simple. Blazingly fast. Build articles in parallel.
  • Inspired by Pelican, which is a static site generator written in Python. Site has a similar concept of Articles and Pages.
  • Inflexible and opinioned by design. Site implements only what the author needs to build a simple static site, like https://hayatoito.github.io/. If you want to customize, I'd recommend to fork Site itself. Site is intentionally kept very small so you can understand codebase and customize it easily.

Install

cargo install site

Usages

No documentations yet.

Meanwhile, as a living document, use hayatoito/hayatoito.github.io as your starter boilerplate. https://hayatoito.github.io/ is built from that repository.

Directory structure

root_dir/
 - src/
   - (Put your markdown files here)
 - template/
   - (Put your template files here)
  • src/ is a directory where your all markdown files live. They are converted into HTML files, using Jinja2 template, and are copied into the output directory.

    Any other resources in src directory are also copied to the output directory.

  • template/ is a directory where jinja2's template files live.

Markdown

site supports markdown:

# Article title

<!--
date: 2021-12-01
-->

# Section

Hello world!

Nothing special except for:

  • The first section is considered as a title of the article.
  • Metadata, such as date follows.

Metadata

TODO: Explain

Template variables

TODO: Explain

Build

CLI

site build --root-dir . --config=config.toml --out-dir out

root-dir should contain src and template directories.

See Make.zsh for the example CLI for various tasks.

GitHub Action

You can also use GitHub Action to build and deploy automatically if you are using GitHub pages. See build.yml as an example.