News as blog posts: richer post page, blog list with pages, archives, drafts and motorino new #11

Merged
squid merged 8 commits from feat/blog-news into main 2026-11-16 11:55:35 +00:00
Owner

I am making the news of kmalloc.org read like a blog (#9). Everything is opt in or backward compatible: a site that does not use the new placeholders and blocks builds as before.

What changes

  • Post page: new placeholders date_long, post_summary, post_meta, post_reading, post_mastodon, post_nav (older, newer, all news), og_type and article_meta (Open Graph article).
  • {{news_blog}}: the blog list (title, long date, categories, description, read more), 10 to a page, with the other pages at page/2/, page/3/ and a pager.
  • Archive pages by year and month (/news/2026/, /news/2026/11/) when templates/archive.html exists, and a {{news_archive}} block.
  • Feed: the summary in description, the full text in content:encoded, plus categories and dc:creator.
  • Header keys Mastodon, Draft and Language; Draft: true and a future date keep a post out of the site; motorino build -drafts shows them.
  • motorino new "title" writes news/<slug>.md as a draft with the header ready.
  • The news have one language (news_language in site.json, else en; a post can set Language), with the interface strings of that language. They still exist once, not once per language.

How I checked it

  • New tests for every feature (blog fields, pagination with 25 posts, archive, drafts and future dates, news language, Open Graph, feed, new, -drafts); make check is green.
  • I built the real site with the changes (templates and language strings are in squid/kmalloc.org, branch feat/blog-news, not merged) and ran the Nu HTML Checker like the CI does: 27 pages, 0 errors, CSS valid.

Not released and not merged: the site needs this version in .motorino-version.

Refs #9

Lists as note panels

In the blog list, on the pages of a category and on the pages of an archive I show every post as a note panel, like the shop block of the services page: a small line with the long date and the categories, the title in bold with a full stop (unless it ends with ., ? or !), the description and a read more link whose aria-label names the post. The page of a post, {{news_list}} and the latest news of the home page do not change. Where a language has no read_more the title is the link on the category and archive pages; the blog list still needs the string.

Review fixes

  • The archive groups the posts by the year and the month as written in their dates. Two posts near midnight at the end of a month, written with different offsets, listed the same month twice and the build failed with "both published as".
  • {{news_archive}} is empty when there are no posts, and the heading of an empty {{news_archive}} or {{categories_list}} goes with it, so a site without news says so once.
  • The build returns the files of the output folder that it did not write, and the command prints a warning that names them (the pages of a list that got shorter stay behind). -clean empties the folder first, only when it is new, empty or holds the .motorino-out file that an earlier -clean left, and never the folder of the site or one that holds it. Without -clean nothing changes and no extra file is written, so the deploy (a new folder published with rsync --delete) is not affected.
  • New tests: exactly ten posts, eleven posts, a single post, a title with quotes, an ampersand, a tag and non Latin letters, a neighbour in another language, posts near midnight, no news at all, and the output folder.

make check is green: 269 tests (167 at the top level), none failing. The Nu HTML Checker finds no error on the real site.

I am making the news of kmalloc.org read like a blog (#9). Everything is opt in or backward compatible: a site that does not use the new placeholders and blocks builds as before. **What changes** - Post page: new placeholders `date_long`, `post_summary`, `post_meta`, `post_reading`, `post_mastodon`, `post_nav` (older, newer, all news), `og_type` and `article_meta` (Open Graph article). - `{{news_blog}}`: the blog list (title, long date, categories, description, read more), 10 to a page, with the other pages at `page/2/`, `page/3/` and a pager. - Archive pages by year and month (`/news/2026/`, `/news/2026/11/`) when `templates/archive.html` exists, and a `{{news_archive}}` block. - Feed: the summary in `description`, the full text in `content:encoded`, plus categories and `dc:creator`. - Header keys `Mastodon`, `Draft` and `Language`; `Draft: true` and a future date keep a post out of the site; `motorino build -drafts` shows them. - `motorino new "title"` writes `news/<slug>.md` as a draft with the header ready. - The news have one language (`news_language` in `site.json`, else `en`; a post can set `Language`), with the interface strings of that language. They still exist once, not once per language. **How I checked it** - New tests for every feature (blog fields, pagination with 25 posts, archive, drafts and future dates, news language, Open Graph, feed, `new`, `-drafts`); `make check` is green. - I built the real site with the changes (templates and language strings are in `squid/kmalloc.org`, branch `feat/blog-news`, not merged) and ran the Nu HTML Checker like the CI does: 27 pages, 0 errors, CSS valid. Not released and not merged: the site needs this version in `.motorino-version`. Refs #9 ## Lists as note panels In the blog list, on the pages of a category and on the pages of an archive I show every post as a note panel, like the shop block of the services page: a small line with the long date and the categories, the title in bold with a full stop (unless it ends with `.`, `?` or `!`), the description and a read more link whose `aria-label` names the post. The page of a post, `{{news_list}}` and the latest news of the home page do not change. Where a language has no `read_more` the title is the link on the category and archive pages; the blog list still needs the string. ## Review fixes - The archive groups the posts by the year and the month as written in their dates. Two posts near midnight at the end of a month, written with different offsets, listed the same month twice and the build failed with "both published as". - `{{news_archive}}` is empty when there are no posts, and the heading of an empty `{{news_archive}}` or `{{categories_list}}` goes with it, so a site without news says so once. - The build returns the files of the output folder that it did not write, and the command prints a warning that names them (the pages of a list that got shorter stay behind). `-clean` empties the folder first, only when it is new, empty or holds the `.motorino-out` file that an earlier `-clean` left, and never the folder of the site or one that holds it. Without `-clean` nothing changes and no extra file is written, so the deploy (a new folder published with `rsync --delete`) is not affected. - New tests: exactly ten posts, eleven posts, a single post, a title with quotes, an ampersand, a tag and non Latin letters, a neighbour in another language, posts near midnight, no news at all, and the output folder. `make check` is green: 269 tests (167 at the top level), none failing. The Nu HTML Checker finds no error on the real site.
- Draft: true and a date in the future keep a post out of the pages, the lists,
  the categories and the feed. motorino build -drafts (next commit) shows them.
- news_language in site.json, and an optional Language key in a post, choose the
  language of the news pages and of the interface strings they use. The news
  still exist once, not once per language.
- New header keys Mastodon (an https address), Draft and Language; a post knows
  its reading time and whether its description was written.

Refs #9
New placeholders for templates/post.html, written in the language of the post:
date_long, post_summary, post_meta, post_reading, post_mastodon and post_nav
(older, newer and all news), plus og_type and article_meta for Open Graph, which
every other page sets to website. A post with a Mastodon address needs the
reply_mastodon string; the other strings are optional and a feature without its
string is left out.

Refs #9
- {{news_blog}} lists the posts as entries (title, long date, categories,
  description, a read more link) 10 to a page; the other pages are written under
  the index, at page/2/, page/3/ and so on, with a pager.
- Archive pages for every year and month that has posts, at /news/2026/ and
  /news/2026/11/, when templates/archive.html exists, and a {{news_archive}} block.

Refs #9
The description of an item is now the plain summary of the post, the full text with
absolute links goes in content:encoded (the end marker of a CDATA section inside
the text is split), and an item has its categories and its author (dc:creator).

Refs #9
feat: motorino new writes a draft, motorino build -drafts previews it
All checks were successful
check / check (pull_request) Successful in 30s
633da1c46b
motorino new -site DIR "A title" writes news/a-title.md with the header ready:
the date of now, the author from site.json, the category News and Draft: true.
motorino build -drafts publishes the drafts and the posts dated in the future,
for a preview. The README describes the header keys, the news language, the blog
placeholders and blocks, and the language strings they use.

Refs #9
feat(news): show the posts of the lists as note panels
All checks were successful
check / check (pull_request) Successful in 30s
71cf14006d
The blog list, the pages of a category and the pages of an archive show every post as a
note panel: a small line with the long date and the categories, the title in bold with
a full stop (unless it ends with a full stop, a question mark or an exclamation mark),
the description and a read more link whose aria-label names the post. The page of a
post, {{news_list}} and the latest news of the home page are unchanged.

A language without read_more gets the title as the link on the category and archive
pages, as those pages worked before; the blog list still needs the string.

Refs #9
- groupArchive compared each post with the last group only, so two posts near midnight
  at the end of a month, written with different offsets, listed the same month twice and
  the build failed with "both published as". Posts are grouped by their own year and
  month, newest first.
- {{news_archive}} is empty when there are no posts, so the index says there is no news
  once, and the heading of an empty {{news_archive}} or {{categories_list}} goes with it.
- tests for exactly ten posts, eleven posts, a single post, a title with quotes, an
  ampersand, a tag and non Latin letters, and a neighbour written in another language

Refs #9
feat(build): report the old files of the output folder, add -clean
All checks were successful
check / check (pull_request) Successful in 29s
52edb15b64
A build never emptied the output folder, so the pages of a list that got shorter stayed
behind. The build now returns the files it did not write and the command prints a
warning that names them. -clean empties the folder first, only when it is new, empty or
holds the .motorino-out file that an earlier -clean left, and never the folder of the site
or one that holds it. The default is unchanged: no extra file in a folder built without it,
so the deploy (a new folder published with rsync --delete) is not affected.

Refs #9
squid merged commit 80c31d0da0 into main 2026-11-16 11:55:35 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
squid/motorino!11
No description provided.