An ever evoluting thing that propulse jtremesay.org.
It's not a generic static site generator. It's really tailored to my needs for jtremesay.org. For most of its life, the code of jssg was merged with the content of jtremesay.org. I moved it to a separate repo because some crazy people wanted to use it for profesisonal stuff‽‽‽.
My needs:
JSSG was successively:
It's currently:
In the future, it will become:
python3 -m pip install --user https://github.com/jtremesay/jssg.git
proj/settings.py
to add the JSSG:INSTALLED_APPS = [
...,
"jssg",
]
proj/urls.py
:from jssg.utils import jssg_urls
urlpatterns = [
# ...
]
# Automatically declare urls for pages, posts and rss feed
urlpatterns += jssg_urls()
You need to set the following variables in your settings.py
:
JSSG_RSS_LINK: str
: The base URL of your site, used in the rss feedJSSG_RSS_TITLE: str
: The description of your site in the rss feedJust put your md files in yourapp/content/posts
and yourapp/content/pages
and JSSG will autodiscover them.
You have full access to the django template engine in the markdown, have fun!
Ex:
---
title: Hello, world!
slug: index
---
## bla bla bla
bla bla bla
Ex:
---
title: Hello, world
date: 2023-05-31T20:00+02:00
---
bla bla bla
You need to provide the page.html
and post.html
template.
Ex:
{% extends "base.html" %}
{% block "content" %}
Published {{ object.timestamp|date:"Y-m-d" }}.
<h1>{{ object.title }}</h1>
{{ object.content_md|safe }}
{% endblock %}
Just use the good old ./manage.py runserver
and build your site like a regular
django project
When your are api with your site, you can generate the static version with distill:
./manage.py distill-local --collectstatic --force dist
The dist
folder contains the generated .html files and the collected statics.
You can now rsync
it to your webserver or whatever.