Sitegeist is a fully custom, performance-first static site generator built from scratch in Python. Inspired by tools like Hugo and Jekyll, it turns your Markdown and HTML into a static website. Comes with zero runtime bloat and total control.
- A recursive node system to build HTML from markdown files
- Support for inline elements (like emphasis and
code) and full block-level Markdown - Simple directory-based routing system to connect the webpages
- A final publishing step that builds your site structure from scratch
- Python - the programming language for non-programmers
- No dependencies – just the Python standard library :)
- Markdown - the internet’s favorite flavor of plain text
- HTML - the old bones of the modern web
- CSS - for custom themes
content/- the site markdown files go heredocs/- contains the generated HTML, CSS and assetssrc/main.py- main driver code for generation of pagesblock.py- type definition and conversion logic for block-level markdowntextnode.py- type definition and conversion logic for text and inline elementshtmlnode.py- superclass for HTML nodesparentnode.py- class definition and logic for HTML parent node elementsleafnode.py- class definition and logic for HTML leaf node elementsutils.py- utilities for title, image and link extraction and parsingtest_*.py- correspondingunittesttest files
static/- the CSS styles and images go herebuild.sh- build the site for productionmain.sh- build and serve the site for devtemplate.html- HTML layout boilerplatetest.sh- run the test suite for development
- Python 3.10+ installed
- Access to a unix-like shell (e.g. zsh or bash)
-
Clone this repository and navigate to it:
git clone git@github.com:tangerineArc/sitegeist.git cd sitegeist -
The repo comes with a pre-built site. Build and serve the site to ensure that everything works fine:
chmod u+x main.sh ./main.sh
The site would be available at
http://127.0.0.1:8888/You might get a
FileNotFoundError. This is caused due to the absence of afavicon.icofile. Add a favicon tostatic/and restart the server if you want to get rid of this error. -
To only build the site:
chmod u+x build.sh ./build.sh
-
Drop your markdown files in the content directory. You can create multiple nested directories within for routing, but each directory must contain exactly 1 markdown file. Each markdown file must be named
index.md. -
Drop any assets such as images or PDFs inside the
static/directory. You can organize different filetypes in different directories insidestaticif you wish. -
Also drop your CSS files in
static/for styling and theming. -
Ensure to keep your URLs in the markdown as well as
template.htmlconsistent with the directory structure.