Source of https://nixhacks.net/
.gitignore | ||
Makefile | ||
README.rst | ||
rst_blg.py | ||
settings.toml |
Static site generator from reStructuredText files. Usage ===== Run:: git clone ttps://git.nxhs.cloud/ge/blog.git && cd blog python3 -m venv env source env/bin/activate pip intall -r requirements.txt mkdir -p {layouts,content,assets/css/pygments} touch settings.toml content/my_page.rst layout/{base,index,post}.j2 make css default Put in settings.toml:: [site] title = 'My site' index_page_title = 'Home page' datetime_format = '%d %b %Y' [build] build_dir = 'build' content_dir = 'content' templates_dir = 'layouts' assets_dir = 'assets' [pygments] theme = 'default' Create basic Jinja2 templates. base.j2:: <!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <link rel="stylesheet" href="assets/css/pygments/{{ pygments_theme }}.css"> <link rel="stylesheet" href="assets/css/custom.css"> </head> <body> <header> <p> {% if posts %} {{ site_title }} {% else %} <a href="/">{{ site_title }}</a> / {{ page_title }}</p> {% endif %} </p> </header> <main> {% block content %}{% endblock %} </main> <footer> </footer> </body> </html> index.j2:: {% extends "base.j2" %} {% block content %} <section> <ul id="posts"> {% for post in posts %} <li> <a href="/{{ post['path'] }}">{{post['title'] }}</a> <span class="meta"> — {{ post['date'] }}</span> </li> {% endfor %} </ul> </section> {% endblock %} post.j2:: {% extends "base.j2" %} {% block content %} <article> {{ post | safe }} <article> {% endblock %} Put in content/my_page.rst:: :title: My first page :date: 01 Jan 1970 ============= My first page ============= Hello, World! Build site:: make See HTML in build/ dir. Write your own CSS styles.