refactor: split the site generator into templates and content, add news
- templates/ holds the page chrome (base, header, footer, badges, leads) - content/<lang>/ holds pages as HTML fragments with front matter and the chrome strings - content/site.toml holds shared values (contact, Bitcoin address, manifesto version) - static/style.css replaces the CSS embedded in the script - add news: Markdown posts in content/<lang>/news/, index page, latest posts on the home page - add [text](url) links and `code` to the Markdown renderer - copy favicons from logo/web so a fresh clone builds the whole site - build.py now uses the standard library only and fails on unknown placeholders
This commit is contained in:
parent
a93adca996
commit
c8b7b6a571
1 changed files with 931 additions and 487 deletions
45
README.md
45
README.md
|
|
@ -2,10 +2,49 @@
|
|||
|
||||
Sources of the kmalloc.org website: plain static HTML, no JavaScript, valid HTML5 and CSS.
|
||||
|
||||
- `build.py` generates the pages: `python3 build.py <output-dir>`.
|
||||
## Layout
|
||||
|
||||
- `build.py` generates the site: `python3 build.py [output-dir]` (default `preview/`). Standard library only.
|
||||
- `templates/` holds the page chrome: `base.html`, `header.html`, `footer.html` and a few small fragments.
|
||||
- `static/style.css` is the one stylesheet, inlined into every page.
|
||||
- `content/site.toml` holds the values shared by every page: contact address, Bitcoin address, manifesto version.
|
||||
- `content/<lang>/lang.toml` holds the chrome strings of one language (`en`, `it`).
|
||||
- `content/<lang>/*.html` are the pages: a front matter block, then an HTML fragment.
|
||||
- `content/<lang>/news/` holds the news posts.
|
||||
- `MANIFESTO.en.md` and `MANIFESTO.it.md` are the manifesto texts, version 1.0.
|
||||
- `fonts/terminess.woff2` is Terminess (Terminus), SIL Open Font License, subset to Latin.
|
||||
- `badges/` holds the official W3C badges, served from our own site.
|
||||
- `logo/` holds the shrike logo: SVG and PNG exports, `build_logo.py` and the original PNG.
|
||||
- `logo/` holds the shrike logo: SVG and PNG exports, `build_logo.py`, the original PNG and the favicons in `logo/web/`.
|
||||
|
||||
I check every page with the Nu HTML Checker before publishing, then copy the output to the web root.
|
||||
## Pages
|
||||
|
||||
A page starts with a front matter block, then the HTML fragment:
|
||||
|
||||
---
|
||||
id: people
|
||||
path: /people.html
|
||||
nav: people
|
||||
title: kmalloc.org: People
|
||||
description: The people behind kmalloc.org.
|
||||
---
|
||||
<h1>People</h1>
|
||||
|
||||
`id` pairs a page with its translation, `nav` is the menu entry to highlight. Placeholders such as `{{contact_shown}}` or `{{url_news}}` are replaced at build time, and an unknown placeholder stops the build.
|
||||
|
||||
## News
|
||||
|
||||
A post is a Markdown file named `YYYY-MM-DD-slug.md` in `content/<lang>/news/`:
|
||||
|
||||
---
|
||||
title: Hello
|
||||
summary: One line shown in the list.
|
||||
---
|
||||
Text with a [link](https://kmalloc.org/) and `code`.
|
||||
|
||||
## A heading
|
||||
|
||||
The post is published at `/news/slug.html` (`/it/news/slug.html` for Italian). A post with the same file name in both languages is linked as a translation. The news index and the latest three posts on the home page are built from the files. No em dashes: the build refuses them.
|
||||
|
||||
## Publishing
|
||||
|
||||
I check every page with the Nu HTML Checker, then copy the output to the web root on the server.
|
||||
|
|
|
|||
Loading…
Reference in a new issue