fssg is a POSIX-compliant, lightweight static site generator written entirely in shell. It converts Markdown and HTML files under src/
into a ready-to-deploy dist/
directory, with support for templating, includes, conditionals, pagination, asset hoisting, and more—no external dependencies required beyond standard POSIX utilities.
- Features
- Prerequisites
- Installation
- Quick Start
- Directory Layout
- Command-Line Options
- Usage Examples
- Advanced Features
- License
-
Pure Shell & POSIX-Compliant No runtime dependencies beyond
sh
,awk
,sed
,find
,cp
, etc. -
Markdown & HTML Support Built-in Markdown-to-HTML parser (headings, lists, tables, bold/italic, links).
-
Templating Global
src/template.html
with{{title}}
and{{content}}
placeholders. -
Includes & Blocks
{{ include:foo.html }}
and{{ include-block:foo.html param="value" }}
for reusable snippets. -
Conditional Rendering
{{ IF_EXT:md }}…{{ ENDIF_EXT }}
or{{ IF_PAGE:about.html }}
to show/hide content. -
Post Listings
{{ recent-posts count="5" }}
and{{ all-posts page_size="10" pagination="true" }}
with auto-pagination. -
Asset Pipeline Copies
src/static/
todist/static/
, hoists & de-duplicates<style>
and<script>
blocks. -
Developer Conveniences Watch mode (
-w
), built-in server (-s
+mongoose
), auto-open (-o
), parallel builds (-j
).
- A POSIX-compliant shell (
sh
,bash
,dash
,zsh
, etc.) - Standard POSIX utilities:
awk
,sed
,find
,cp
,mkdir
,rm
,chmod
, etc.
wget https://github.com/xlc-dev/fssg/raw/main/fssg
chmod +x fssg
Place fssg
in your project root.
If you intend to use the built-in server (-s
) you may also want the mongoose
binaries:
git clone https://github.com/xlc-dev/fssg.git
cp fssg/fssg ./my-site/
cp -r fssg/mongoose ./my-site/mongoose/
chmod +x ./my-site/fssg
-
Create your project structure (see next section).
-
Write content in
src/
as.md
or.html
. -
Run the generator:
./fssg
-
Browse output in
dist/
.
your-project/
├── fssg # shell script
└── src/
├── template.html # global layout ({{title}}, {{content}})
├── index.md # page content (Markdown or HTML)
├── about.html # additional pages
├── includes/ # reusable snippets
│ └── header.html
└── static/ # CSS, images, fonts, etc.
└── img/
└── logo.png
template.html
: contains your<head>
/<body>
skeleton.src/*.md|html
: content files—Markdown is auto-converted.src/includes/
: files for{{ include:… }}
and{{ include-block:… }}
.src/static/
: copied verbatim todist/static/
.
./fssg [options]
-h
Show help and exit-q
Quiet mode (errors only)-v
Verbose mode (build details)-n
No color in output-w
Watchsrc/
for changes and rebuild-s
Start local server (requiresmongoose/
)-o
Auto-open browser (requires-s
)-j <num>
Parallel build jobs (default: 4)
src/index.md
:
{{title: Home}}
# Welcome to My Site
This site is generated by **fssg**.
src/template.html
:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>{{title}}</title>
<link rel="stylesheet" href="/static/style.css" />
</head>
<body>
{{content}}
</body>
</html>
./fssg
# → dist/index.html
src/includes/footer.html
:
<footer>
<p>© 2025 My Company</p>
</footer>
Usage in a page:
{{ include:footer.html }}
{{ IF_EXT:md }}
<p>This only appears in Markdown-converted pages.</p>
{{ ENDIF_EXT }} {{ IF_PAGE:about.html }}
<p>This is the About page.</p>
{{ ENDIF_PAGE }}
<h2>Latest Posts</h2>
{{ recent-posts count="3" ul_class="posts" li_class="post" show_images="true" }}
- Inline Parameters in
include-block
:{{ include-block:card.html title="Hello" }} <p>Block content goes here</p> {{ endinclude }}
- Pagination with
all-posts
:{{ all-posts page_size="5" page="2" pagination="true" }}
- Style & Script Hoisting:
All
<style>
tags move to<head>
,<script>
tags to end of<body>
, deduplicated.
For full details, see the fssg Documentation Website.
This project is licensed under the MIT License. See LICENSE for details.