From 2edf77aaa7f150fbaf56af0c328a01fd8f67746b Mon Sep 17 00:00:00 2001 From: yann64 Date: Sun, 11 Oct 2026 22:07:30 +0200 Subject: [PATCH] Comments at the bottom of machine pages instead of a tab Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01YDRjtmAiNpo5mK5N3d7QwZ --- README.md | 4 +-- assets/css/main.css | 1 + content/machine-tabs/apple-ii/comments.md | 7 ----- .../machine-tabs/commodore-c64/comments.md | 7 ----- .../machine-tabs/kaypro-pc-286i/comments.md | 7 ----- .../magnavox-odyssey-100/comments.md | 7 ----- .../machine-tabs/magnavox-odyssey/comments.md | 7 ----- content/machine-tabs/nec-pc-6601/comments.md | 7 ----- content/museum/apple-ii.md | 1 - content/museum/commodore-c64.md | 1 - content/museum/kaypro-pc-286i.md | 1 - content/museum/magnavox-odyssey-100.md | 1 - content/museum/magnavox-odyssey.md | 1 - content/museum/nec-pc-6601.md | 1 - forum/README.md | 5 ++-- forum/extension/less/embed.less | 2 +- hugo.toml | 2 +- layouts/_partials/comments.html | 29 +++++++++++++++++++ layouts/_partials/machine-header.html | 2 +- layouts/baseof.html | 2 +- layouts/machine-tabs/single.html | 21 +------------- layouts/museum/single.html | 1 + 22 files changed, 40 insertions(+), 77 deletions(-) delete mode 100644 content/machine-tabs/apple-ii/comments.md delete mode 100644 content/machine-tabs/commodore-c64/comments.md delete mode 100644 content/machine-tabs/kaypro-pc-286i/comments.md delete mode 100644 content/machine-tabs/magnavox-odyssey-100/comments.md delete mode 100644 content/machine-tabs/magnavox-odyssey/comments.md delete mode 100644 content/machine-tabs/nec-pc-6601/comments.md create mode 100644 layouts/_partials/comments.html diff --git a/README.md b/README.md index 405258ed..f23d3892 100644 --- a/README.md +++ b/README.md @@ -44,8 +44,8 @@ to try the search locally. ## Forum and comments A [Flarum](https://flarum.org/) forum can run next to the site and serve as its comment system: -with `params.forum.url` set in `hugo.toml`, the menu gets a Forum entry and the Comments tab of -each machine shows that machine's forum thread (archived comments first, new replies after). +with `params.forum.url` set in `hugo.toml`, the menu gets a Forum entry and every page of a +machine ends with that machine's forum thread (archived comments first, new replies after). With the url empty the site has no forum and shows the archived comments as static text. Everything about the forum is in [`forum/README.md`](forum/README.md). diff --git a/assets/css/main.css b/assets/css/main.css index ce219482..d1780d39 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -164,3 +164,4 @@ table { border-collapse: collapse; } .pager .current { font-weight: 700; border-color: var(--accent); } .forum-thread { display: block; width: 100%; min-height: 400px; border: 0; } +.comments-section { clear: both; margin-top: 32px; } diff --git a/content/machine-tabs/apple-ii/comments.md b/content/machine-tabs/apple-ii/comments.md deleted file mode 100644 index e8d377af..00000000 --- a/content/machine-tabs/apple-ii/comments.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: APPLE II -url: /museum/apple-ii/comments/ -params: - machine: /museum/apple-ii - tab: comments ---- diff --git a/content/machine-tabs/commodore-c64/comments.md b/content/machine-tabs/commodore-c64/comments.md deleted file mode 100644 index 365d2895..00000000 --- a/content/machine-tabs/commodore-c64/comments.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Commodore C64 -url: /museum/commodore-c64/comments/ -params: - machine: /museum/commodore-c64 - tab: comments ---- diff --git a/content/machine-tabs/kaypro-pc-286i/comments.md b/content/machine-tabs/kaypro-pc-286i/comments.md deleted file mode 100644 index 27abf346..00000000 --- a/content/machine-tabs/kaypro-pc-286i/comments.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Kaypro PC & 286i -url: /museum/kaypro-pc-286i/comments/ -params: - machine: /museum/kaypro-pc-286i - tab: comments ---- diff --git a/content/machine-tabs/magnavox-odyssey-100/comments.md b/content/machine-tabs/magnavox-odyssey-100/comments.md deleted file mode 100644 index dbbd422e..00000000 --- a/content/machine-tabs/magnavox-odyssey-100/comments.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: MAGNAVOX Odyssey 100 -url: /museum/magnavox-odyssey-100/comments/ -params: - machine: /museum/magnavox-odyssey-100 - tab: comments ---- diff --git a/content/machine-tabs/magnavox-odyssey/comments.md b/content/machine-tabs/magnavox-odyssey/comments.md deleted file mode 100644 index b1ee1f08..00000000 --- a/content/machine-tabs/magnavox-odyssey/comments.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: MAGNAVOX Odyssey -url: /museum/magnavox-odyssey/comments/ -params: - machine: /museum/magnavox-odyssey - tab: comments ---- diff --git a/content/machine-tabs/nec-pc-6601/comments.md b/content/machine-tabs/nec-pc-6601/comments.md deleted file mode 100644 index 7bea5656..00000000 --- a/content/machine-tabs/nec-pc-6601/comments.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: NEC PC 6601 -url: /museum/nec-pc-6601/comments/ -params: - machine: /museum/nec-pc-6601 - tab: comments ---- diff --git a/content/museum/apple-ii.md b/content/museum/apple-ii.md index 4d7dbbaa..142ac5ac 100644 --- a/content/museum/apple-ii.md +++ b/content/museum/apple-ii.md @@ -66,7 +66,6 @@ params: - links - docs - videos - - comments forum_thread: 7 photos: - title: INSIDE AN APPLE II diff --git a/content/museum/commodore-c64.md b/content/museum/commodore-c64.md index 389dd7f9..825bb1d5 100644 --- a/content/museum/commodore-c64.md +++ b/content/museum/commodore-c64.md @@ -71,7 +71,6 @@ params: - links - docs - videos - - comments forum_thread: 8 photos: - title: COMMODORE 64 diff --git a/content/museum/kaypro-pc-286i.md b/content/museum/kaypro-pc-286i.md index 542e1d0b..c26bcb88 100644 --- a/content/museum/kaypro-pc-286i.md +++ b/content/museum/kaypro-pc-286i.md @@ -66,7 +66,6 @@ params: value: From $4500 in 1985 - $2995 in 1987 tabs: - photos - - comments forum_thread: 11 photos: - title: COMPLETE SYSTEM diff --git a/content/museum/magnavox-odyssey-100.md b/content/museum/magnavox-odyssey-100.md index 8846337d..483d1bbe 100644 --- a/content/museum/magnavox-odyssey-100.md +++ b/content/museum/magnavox-odyssey-100.md @@ -53,7 +53,6 @@ params: - photos - links - docs - - comments forum_thread: 12 photos: - title: ODYSSEY 100 diff --git a/content/museum/magnavox-odyssey.md b/content/museum/magnavox-odyssey.md index 89a79e51..f13a66f6 100644 --- a/content/museum/magnavox-odyssey.md +++ b/content/museum/magnavox-odyssey.md @@ -51,7 +51,6 @@ params: - emulators - links - videos - - comments forum_thread: 10 photos: - title: MAIN UNIT diff --git a/content/museum/nec-pc-6601.md b/content/museum/nec-pc-6601.md index 90f30524..e8a214a5 100644 --- a/content/museum/nec-pc-6601.md +++ b/content/museum/nec-pc-6601.md @@ -68,7 +68,6 @@ params: - photos - adverts - links - - comments forum_thread: 9 photos: - title: PC-6601 diff --git a/forum/README.md b/forum/README.md index e6753914..f13e16df 100644 --- a/forum/README.md +++ b/forum/README.md @@ -28,10 +28,9 @@ frame. can be run again when new machines arrive. `--replace` deletes and re-imports the imported threads that have no reply from a real member (their thread numbers change). It writes the map machine → discussion to `forum.json`. -- Copied to `../data/forum.json`, that map makes `make content` give every machine a Comments - tab pointing at its thread (`forum_thread` in the page front matter); the old comments are +- Copied to `../data/forum.json`, that map makes `make content` link every machine to its thread (`forum_thread` in the page front matter); the old comments are then no longer written into the pages. -- With `params.forum.url` set, the Comments tab shows `/embed/` (Flarum's Embed +- With `params.forum.url` set, the bottom of the machine's pages shows `/embed/` (Flarum's Embed extension) in a frame that follows the height of the thread. ## Local test diff --git a/forum/extension/less/embed.less b/forum/extension/less/embed.less index 58ff694d..90581efb 100644 --- a/forum/extension/less/embed.less +++ b/forum/extension/less/embed.less @@ -1,4 +1,4 @@ -// Embedded thread, as shown in the Comments tab of the museum pages: full width, on the +// Embedded thread, as shown at the bottom of the museum pages: full width, on the // light panel colour of the static site (--panel in its assets/css/main.css). @oc-accent: #9a3412; @oc-panel: #fffdf7; diff --git a/hugo.toml b/hugo.toml index 54a2ea14..0e8c3728 100644 --- a/hugo.toml +++ b/hugo.toml @@ -20,7 +20,7 @@ capitalizeListTitles = false description = "The Old-Computers.com museum of computers, consoles and pongs, rebuilt from the Wayback Machine archive." # Forum (Flarum, see forum/README.md). Empty url = no forum: no menu entry, and machine pages - # show the archived comments as static text. With a url, the Comments tab shows the forum thread. + # show the archived comments as static text. With a url, machine pages end with their forum thread. [params.forum] url = "https://barbel.synology.me/oldcomputers-forum" diff --git a/layouts/_partials/comments.html b/layouts/_partials/comments.html new file mode 100644 index 00000000..52f09129 --- /dev/null +++ b/layouts/_partials/comments.html @@ -0,0 +1,29 @@ +{{/* Visitor comments at the bottom of a machine's pages. Context: the machine page. + With a forum (params.forum.url) and a thread for the machine: the live thread in a frame + sized to its content. Otherwise: the archived comments as static text. */}} +{{ $p := .Params }} +{{ if and $p.forum_thread site.Params.forum.url }} +
+

Comments

+ {{ $thread := printf "%s/embed/%d" (strings.TrimSuffix "/" site.Params.forum.url) (int $p.forum_thread) }} +

The first comments were left by visitors of the original site. Log in to the forum to add yours. Open this discussion in the forum.

+ + {{ with resources.Get "js/iframeResizer.min.js" | fingerprint }} + + + {{ end }} +
+{{ else if $p.comments }} +
+

Comments

+

Comments left by visitors of the original site. New comments are closed.

+
    + {{ range $p.comments }} +
  1. +

    {{ .author }}{{ with .date }} · {{ . }}{{ end }}

    +
    {{ .text | markdownify }}
    +
  2. + {{ end }} +
+
+{{ end }} diff --git a/layouts/_partials/machine-header.html b/layouts/_partials/machine-header.html index 277299eb..2e76cfc0 100644 --- a/layouts/_partials/machine-header.html +++ b/layouts/_partials/machine-header.html @@ -1,6 +1,6 @@ {{/* dict "machine" "tab" */}} {{ $m := .machine }} -{{ $labels := dict "photos" "Photos" "adverts" "Adverts" "hardware" "Hardware" "connectors" "Connectors" "software" "Software" "emulators" "Emulators" "links" "Links" "docs" "Docs" "videos" "Videos" "comments" "Comments" }} +{{ $labels := dict "photos" "Photos" "adverts" "Adverts" "hardware" "Hardware" "connectors" "Connectors" "software" "Software" "emulators" "Emulators" "links" "Links" "docs" "Docs" "videos" "Videos" }}

Museum diff --git a/layouts/baseof.html b/layouts/baseof.html index 21a88d1e..e145d74c 100644 --- a/layouts/baseof.html +++ b/layouts/baseof.html @@ -24,7 +24,7 @@

{{/* search index: content pages only (not lists), filterable by section; see layouts/search.html */}} - {{ $indexed := and .IsPage (ne .Layout "search") (ne .Params.tab "comments") }} + {{ $indexed := and .IsPage (ne .Layout "search") }} {{ $section := "" }}{{ with .FirstSection }}{{ if not .IsHome }}{{ $section = .Title }}{{ end }}{{ end }} {{ if eq .Section "machine-tabs" }}{{ $section = "Museum" }}{{ end }} diff --git a/layouts/machine-tabs/single.html b/layouts/machine-tabs/single.html index 4dbc40b9..a62761b8 100644 --- a/layouts/machine-tabs/single.html +++ b/layouts/machine-tabs/single.html @@ -33,26 +33,7 @@ {{ end }} - {{ else if and (eq $tab "comments") $p.forum_thread site.Params.forum.url }} - {{/* live comments: the machine's forum thread, shown in a frame sized to its content */}} - {{ $thread := printf "%s/embed/%d" (strings.TrimSuffix "/" site.Params.forum.url) (int $p.forum_thread) }} -

The first comments were left by visitors of the original site. Log in to the forum to add yours. Open this discussion in the forum.

- - {{ with resources.Get "js/iframeResizer.min.js" | fingerprint }} - - - {{ end }} - - {{ else if eq $tab "comments" }} -

Comments left by visitors of the original site. New comments are closed.

-
    - {{ range $p.comments }} -
  1. -

    {{ .author }}{{ with .date }} · {{ . }}{{ end }}

    -
    {{ .text | markdownify }}
    -
  2. - {{ end }} -
{{ end }} + {{ partial "comments.html" $m }} {{ end }} diff --git a/layouts/museum/single.html b/layouts/museum/single.html index 17ce8f5d..844ad733 100644 --- a/layouts/museum/single.html +++ b/layouts/museum/single.html @@ -4,5 +4,6 @@ {{ with .Params.image }}{{ $.Title }}{{ end }}
{{ .Content }}
{{ with .Params.specs }}{{ partial "specs.html" . }}{{ end }} + {{ partial "comments.html" . }} {{ end }}