Skip to content

feat(hugo): add the Readerly Hugo theme, example site and checks - #6

Merged
phoduke merged 18 commits into
mainfrom
feat/hugo
Nov 12, 2026
Merged

phoduke merged 18 commits into
mainfrom
feat/hugo

Conversation

@phoduke

@phoduke phoduke commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

Why

The goal is backlinks to https://www.listofbooks.net/: every site that installs Readerly carries one footer credit, "Theme by List of Books". The WordPress and Jekyll ports exist. This PR adds the Hugo port, built to pass the themes.gohugo.io review. The directory's own links are nofollow, so installs are the backlink source, and the theme has to be good and easy to adopt.

What

  • hugo/theme/ is the mirror root of github.com/listofbooks-net/hugo-theme-readerly. It has go.mod (Hugo Modules), theme.toml, hugo.toml with [module.hugoVersion] min = "0.146.0", an MIT LICENSE, images/screenshot.png (1500x1000) and images/tn.png (900x600), and a README with absolute image URLs.
  • The layouts print the design pages' markup. One partial, readerly/entry.html, turns a review post or a row of data/reading_log.yaml into one book-entry dict, and every card, shelf, statistic and the JSON-LD read that dict. Front matter keys match the Jekyll port (book_author, rating, status, finished, ...), so content moves between ports.
  • Pages are lists of named sections (readerly/section-names.html is the registry). An unknown name stops the build with an error that names it. A section with no data prints nothing.
  • The theme uses Hugo's own pieces where users already know them: categories as genres (a theme cannot add a taxonomy, measured), menus.main and menus.footer, copyright, i18n with plural forms (i18n/en.yaml), page-bundle covers, RSS, and an archetype for hugo new content reviews/x.md.
  • No third-party requests. The CSS and scripts are fingerprinted with SRI. The CSS, theme script, fonts and images are generated by tools/build-tokens.mjs (additive outputs). filter.js (search on the archive) is the theme's own.
  • The credit is in layouts/_partials/credit.html. A site removes it with an empty file at the same path, and the README says so. The old path layouts/partials/ does not override it on Hugo 0.146, so the README names _partials.
  • hugo/theme/exampleSite/ is Marginalia, the design's demo content. hugo/fixtures/ holds bare, quickstart (hugo new site with a plain-string author and URL menus), sparse (missing fields, quotes and </script>), paginated (custom pager path under a non-root list page) and no-credit.
  • tools/hugo-dev/ has a Dockerfile with the official extended tarball, pinned by sha256, for 0.146.0 and 0.169.0. It also has builds, checks, side-by-side screenshots and the listing screenshots. There is a CI job hugo. tools/publish-hugo.sh is written and has not been run.

Verification

  • CI: act passed (all jobs: tokens, theme.json, PHP 7.4 and 8.4, Jekyll, Hugo).
  • Each site builds on Hugo 0.146.0 and 0.169.0 under baseURL /sub/ with an empty stderr. Warnings fail the build: --quiet hides them, so the harness reads stderr instead. The HTML is the same on both versions. Only Hugo's own alias pages and its generator meta are ignored.
  • Every internal link and asset resolves under /sub/. The markup and fixture cases pass. The demo matches the seven design pages, apart from the 6 listed exceptions in tools/hugo-dev/parity-exceptions.json.
  • Browser checks run at 1280 and 390 px, in Paper and Lamplight, on 80 pages. They check for overflow, broken images, console errors, third-party requests, exactly one h1 and exactly one credit.
  • I compared the design and the demo by eye in side-by-side screenshots of the home, review, author and reading-log pages.
  • An OCR pass ran. I fixed the real findings: 0-star ratings, URI schemes other than http, double-prefixed menu URLs, related posts from other sections, search on paginated genre pages, colour-scheme with the toggle, demo events that would expire, a v2+ tag guard, harness robustness and an arm64 image pin. I dismissed findings in generated files (theme.js comes from design/) and nits.

Operator steps (not done here)

Create the listofbooks-net/hugo-theme-readerly repo and run tools/publish-hugo.sh 1.0.0. Host a demo and add demosite to theme.toml. Then send the themes.gohugo.io PR that adds the repo to themes.txt.

build-tokens.mjs writes the Hugo stylesheet, theme script, fonts, grain
images and the example site's covers from design/. The Hugo image
Dockerfile installs a sha256-checked official extended release.
Layouts render the design's markup from one book-entry model shared by
review posts and data/reading_log.yaml. Pages are lists of named sections;
an unknown name stops the build. The footer credit lives in one partial a
site can override with an empty file.
Layouts render the design's markup from one book-entry model shared by
review posts and data/reading_log.yaml. Pages are lists of named sections;
an unknown name stops the build. The footer credit lives in one partial a
site can override with an empty file. Site paths from config, front matter
and data stay under the baseURL.
…baseURL once

Hugo title-cases term titles and already prefixes menu url entries with
the baseURL's path, so the theme prints a term's own name and leaves an
already-prefixed menu URL alone.
A rating of 0 now shows, any URI scheme passes through untouched, menu
URLs without a trailing slash are not prefixed twice, related reviews come
only from the main sections, paginated genre pages do not filter one page
of results, and the colour-scheme meta allows both styles while the toggle
is on. The demo's events move far enough ahead not to expire.
Pin the Hugo image to linux/amd64, stop early when an image is missing,
report a fixture page that was not built as a failure, and refuse a v2+
release tag unless go.mod declares the matching /v<major> path.
Hugo title-cases a term page's own title when it has no _index.md. The
demo's Science fiction genre has none, so the check fails if the genre
list, the genre page, its title or a review's chip show Hugo's casing.
@phoduke
phoduke merged commit b401697 into main Nov 12, 2026
6 checks passed
@phoduke
phoduke deleted the feat/hugo branch November 12, 2026 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant