diff --git a/README.md b/README.md
index 536049f..d31e678 100644
--- a/README.md
+++ b/README.md
@@ -65,8 +65,8 @@ The news exist once, not once per language. Their language is `news_language` in
Everything below is opt in, so a site that does not use it builds as it did.
- **The post page** (`templates/post.html`) has, besides `post_title`, `date`, `post_body` and `post_byline`: `date_long` (such as "14 November 2026"), `post_summary` (the written description as a lead paragraph), `post_meta` (a line with the date, the author, the category links and the reading time), `post_reading`, `post_mastodon` (the reply link) and `post_nav` (the newer post, the older post and all the news). `og_type` is `article` there and `website` on every other page, and `article_meta` holds the published time and a tag for each category, for the head of `base.html`.
-- **The blog list**: a paragraph with only `{{news_blog}}` on the news index 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/`, with a pager. The block needs an index page.
-- **The archive**: when `templates/archive.html` exists, every year and month with posts gets a page, `/news/2026/` and `/news/2026/11/`, with `archive_name`, `archive_nav` and `archive_posts`. `{{news_archive}}` lists the years and the months with their counts, and needs the template.
+- **The blog list**: a paragraph with only `{{news_blog}}` on the news index lists the posts as note panels (`
`: 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 named after the post), 10 to a page. The other pages are written under the index, at `page/2/`, `page/3/`, with a pager. The block needs an index page.
+- **The archive**: when `templates/archive.html` exists, every year and month with posts gets a page, `/news/2026/` and `/news/2026/11/`, with `archive_name`, `archive_nav` and `archive_posts`. The posts of an archive page, of a category page and of the blog list are the same panels; where the language has no `read_more` the title is the link instead, except on the blog list, where it is an error. `{{news_list}}` and the latest news of the home page stay plain lists. `{{news_archive}}` lists the years and the months with their counts, and needs the template.
- **The feed** (`/news/feed.xml`) has the summary in `description` and the full text, with absolute links, in `content:encoded`, plus the categories and the author.
The strings come from the language files. These are required when the feature is used: `read_more`, `pager_label`, `pager_newer`, `pager_older` and `pager_page` (`Page {n} of {total}`) for the blog list, and `reply_mastodon` for a post with a Mastodon address. These are optional, and without them the feature is left out: `date_long` (`{d} {month} {y}`) and `month_01` to `month_12` (without them the date is `2026-11-14`), `date_month_year` (`{month} {y}`), `reading_time` (`{n} min read`), and `post_older`, `post_newer` and `post_nav` for the links between posts. The archive uses `archive_h` in its template and, optionally, `archive_up`.
diff --git a/internal/build/blog.go b/internal/build/blog.go
index b0e47cf..1395840 100644
--- a/internal/build/blog.go
+++ b/internal/build/blog.go
@@ -40,35 +40,6 @@ func (b *builder) pageLabel(lang string, n, total int) (string, error) {
return strings.NewReplacer("{n}", strconv.Itoa(n), "{total}", strconv.Itoa(total)).Replace(text), nil
}
-// blogEntry returns one entry of the blog list: the title as a link, the date
-// and the categories, the description as a preview and a link to read more.
-// lang is the language of the page; a post in another language is marked.
-func (b *builder) blogEntry(p content.Post, lang string) (string, error) {
- l := b.langs[lang]
- more := l.Strings["read_more"]
- if more == "" {
- return "", fmt.Errorf("lang/%s.json: the language has no read_more string, which the blog list needs", lang)
- }
- mark := ""
- if p.Language != "" && p.Language != lang {
- mark = fmt.Sprintf(` hreflang="%s" lang="%s"`, p.Language, p.Language)
- }
- meta := fmt.Sprintf(``, p.Date.Format(dateOnly), render.Escape(longDate(p.Date, l)))
- if links := categoryLinks(p); links != "" {
- meta += " · " + links
- }
- var out strings.Builder
- out.WriteString("\n")
- fmt.Fprintf(&out, "
")
+}
+
+// TestPanelsOnCategoryAndArchivePages checks that the lists of the categories and of the archives are panels too,
+// and that the page of a post and the latest news of the home page are not.
+func TestPanelsOnCategoryAndArchivePages(t *testing.T) {
+ out, err := buildWith(t, blogSite(map[string]string{"content/en/news/index.md": blogIndex, "templates/archive.html": archiveTemplate}), nil)
+ if err != nil {
+ t.Fatalf("Build() error = %v", err)
+ }
+ shop := "A shop.\nAbout the shop.\n" + `Read more.`
+ for rel, want := range map[string]int{"news/category/flug.html": 2, "news/2026/index.html": 3, "news/2026/11/index.html": 2} {
+ got := readOut(t, out, rel)
+ if n := strings.Count(got, `role="note"`); n != want {
+ t.Errorf("%s has %d panels, want %d", rel, n, want)
+ }
+ if !strings.Contains(got, shop) {
+ t.Errorf("%s lacks the panel of the shop post", rel)
+ }
+ if strings.Contains(got, "
")
+ if strings.Contains(got, "aria-label") || strings.Contains(got, "Read more") {
+ t.Errorf("%s has a read more link without the string", rel)
+ }
+ }
+ _, err = buildWith(t, blogSite(map[string]string{"lang/en.json": withoutMore, "content/en/news/index.md": blogIndex, "templates/archive.html": archiveTemplate}), nil)
+ if err == nil || !strings.Contains(err.Error(), "read_more") {
+ t.Errorf("error = %v, want one that names read_more", err)
+ }
+}
+
+// TestPanelOfAPostInAnotherLanguage checks that the link of a panel says the language of a post that is not in the language of the page.
+func TestPanelOfAPostInAnotherLanguage(t *testing.T) {
+ out, err := buildWith(t, blogSite(map[string]string{"content/en/news/index.md": blogIndex, "templates/archive.html": archiveTemplate,
+ "news/ciao.md": "Title: Ciao\nDate: 2026-11-05T09:00:00+0100\nLanguage: it\n-\nUn testo.\n"}), nil)
+ if err != nil {
+ t.Fatalf("Build() error = %v", err)
+ }
+ index := readOut(t, out, "news/index.html")
+ mustContain(t, "news index", index, `Read more.`)
+ if strings.Count(index, `hreflang="it" lang="it">Read more`) != 1 {
+ t.Error("an English post is marked as written in Italian")
+ }
+}
diff --git a/internal/build/news.go b/internal/build/news.go
index 93ea37f..eafa38c 100644
--- a/internal/build/news.go
+++ b/internal/build/news.go
@@ -41,6 +41,64 @@ func newsItem(p content.Post, lang string, withDescription bool) string {
return item + ""
}
+// newsPanel returns a post for a list of the news as a note panel: first a small
+// line with the date and the categories, then the title in bold with a full stop
+// (unless it ends with one, a question mark or an exclamation mark), then the
+// description, then the link to read more, which names the post for a reader that
+// hears the links out of context. lang is the language of the page; the link of a
+// post in another language says so. Without the string read_more the title is the
+// link and there is no link to read more, unless needMore is set: the blog list has
+// no other link to the post, so there it is an error.
+func (b *builder) newsPanel(p content.Post, lang string, needMore bool) (string, error) {
+ l := b.langs[lang]
+ more := l.Strings["read_more"]
+ if more == "" && needMore {
+ return "", fmt.Errorf("lang/%s.json: the language has no read_more string, which the blog list needs", lang)
+ }
+ mark := ""
+ if p.Language != "" && p.Language != lang {
+ mark = fmt.Sprintf(` hreflang="%s" lang="%s"`, p.Language, p.Language)
+ }
+ meta := fmt.Sprintf(`%s`, p.Date.Format(dateOnly), render.Escape(longDate(p.Date, l)))
+ if links := categoryLinks(p); links != "" {
+ meta += " · " + links
+ }
+ title := p.Title
+ if !strings.HasSuffix(title, ".") && !strings.HasSuffix(title, "?") && !strings.HasSuffix(title, "!") {
+ title += "."
+ }
+ var out strings.Builder
+ out.WriteString("
")
+ return out.String(), nil
+}
+
+// newsPanels returns the panels of the posts of a category or of an archive,
+// one after the other, or an empty string when there are none.
+func (b *builder) newsPanels(posts []content.Post, lang string) (string, error) {
+ panels := make([]string, len(posts))
+ for i, p := range posts {
+ panel, err := b.newsPanel(p, lang, false)
+ if err != nil {
+ return "", err
+ }
+ panels[i] = panel
+ }
+ return strings.Join(panels, "\n"), nil
+}
+
// newsList returns the full list of the news as a
, or an empty string
// when there are no posts.
func newsList(posts []content.Post, lang string) string {
diff --git a/internal/build/pages.go b/internal/build/pages.go
index 5506fe8..f6296ba 100644
--- a/internal/build/pages.go
+++ b/internal/build/pages.go
@@ -261,7 +261,11 @@ func (b *builder) renderCategories() error {
}
ctx := b.documentContext(d)
ctx["category_name"] = render.Escape(c.Name)
- ctx["category_posts"] = newsList(c.posts, b.newsLang)
+ panels, err := b.newsPanels(c.posts, b.newsLang)
+ if err != nil {
+ return err
+ }
+ ctx["category_posts"] = panels
body, err := render.Substitute("templates/category.html", tmpl, ctx)
if err != nil {
return err