refactor: keep every text in one JSON file per language
- move the texts of each language into lang/<lang>.json and the shared data into site.json - replace the per-language HTML fragments with one template per page type in templates/pages - add templates/parts for the repeated service and person blocks - move the news posts to news/ - a language lists only the pages it has, so adding one is a single file - the generated pages are unchanged - update the README
This commit is contained in:
parent
b0c6706a90
commit
21103486f8
1 changed files with 683 additions and 712 deletions
38
README.md
38
README.md
|
|
@ -5,35 +5,35 @@ Sources of the kmalloc.org website: plain static HTML, no JavaScript, valid HTML
|
|||
## 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.
|
||||
- `site.json` holds what every language shares: the language list, contact address, Bitcoin address, manifesto version, services and people.
|
||||
- `lang/<lang>.json` holds every text of one language (`en`, `it`, `es`, `de`, `fr`): the menu, the footer and one entry per page. The texts are plain text and the build escapes them.
|
||||
- `templates/` holds the chrome (`base.html`, `header.html`, `footer.html`), one body per page type in `templates/pages/` and repeated blocks in `templates/parts/`.
|
||||
- `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`, `es`, `de`, `fr`). Spanish, German and French have the manifesto only and use the short header (`templates/header-min.html`).
|
||||
- `content/<lang>/*.html` are the pages: a front matter block, then an HTML fragment.
|
||||
- `content/en/news/` holds the news posts. News are written in English only.
|
||||
- `MANIFESTO.en.md` and `MANIFESTO.it.md` are the manifesto texts, version 1.0. `MANIFESTO.es.md`, `MANIFESTO.de.md` and `MANIFESTO.fr.md` are translations of it.
|
||||
- `MANIFESTO.<lang>.md` are the manifesto texts, version 1.0. English and Italian are the sources, Spanish, German and French are translations.
|
||||
- `news/` holds the news posts, written in English only.
|
||||
- `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`, the original PNG and the favicons in `logo/web/`.
|
||||
|
||||
## Pages
|
||||
## Languages
|
||||
|
||||
A page starts with a front matter block, then the HTML fragment:
|
||||
A new language is one file, `lang/<lang>.json`, plus its name in `site.json` and a `MANIFESTO.<lang>.md`. A language lists only the pages it has: Spanish, German and French have the manifesto only, so they use the short header (`"header": "header-min"`) and the other pages are not built for them. The language links in the header list every other language that has the same page.
|
||||
|
||||
---
|
||||
id: people
|
||||
path: /people.html
|
||||
nav: people
|
||||
title: kmalloc.org: People
|
||||
description: The people behind kmalloc.org.
|
||||
---
|
||||
<h1>People</h1>
|
||||
A page entry in `lang/<lang>.json` looks like this:
|
||||
|
||||
`id` pairs a page with its translations, `nav` is the menu entry to highlight. The language links in the header list every other language that has a page with the same `id`. Placeholders such as `{{contact_shown}}` or `{{url_news}}` are replaced at build time, and an unknown placeholder stops the build.
|
||||
"people": {
|
||||
"path": "/people.html",
|
||||
"title": "kmalloc.org: People",
|
||||
"description": "The people behind kmalloc.org.",
|
||||
"intro": "Who is behind kmalloc.org.",
|
||||
"bios": { "squid": "..." }
|
||||
}
|
||||
|
||||
The page types are `home`, `manifesto`, `people`, `services` and `news`. Placeholders such as `{{intro}}` or `{{url_news}}` in `templates/pages/*.html` 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/en/news/`:
|
||||
A post is a Markdown file named `YYYY-MM-DD-slug.md` in `news/`:
|
||||
|
||||
---
|
||||
title: Hello
|
||||
|
|
@ -43,7 +43,7 @@ A post is a Markdown file named `YYYY-MM-DD-slug.md` in `content/en/news/`:
|
|||
|
||||
## A heading
|
||||
|
||||
The post is published at `/news/slug.html`. News are English only: the Italian pages list the same posts and link to them. The news index, the latest three posts on the home pages and an RSS 2.0 feed (`/news/feed.xml`, the latest 20 posts with full text) are built from the files. Every page links the feed in the head and shows the RSS icon in the footer. No em dashes: the build refuses them.
|
||||
The post is published at `/news/slug.html`. News are English only: the pages of the other languages list the same posts and link to them. The news index, the latest three posts on the home pages and an RSS 2.0 feed (`/news/feed.xml`, the latest 20 posts with full text) are built from the files. Every page links the feed in the head and shows the RSS icon in the footer. No em dashes: the build refuses them.
|
||||
|
||||
## Publishing
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue