Repository navigation
fix: clear the Hugo deprecations behind live-editing guards - #388
Merged
Merged
Conversation
CloudCannon's Live Editor renders partials in Bookshop's embedded Hugo v0.147.6 (@bookshop/hugo-engine), where newer template APIs such as hugo.Data fail. tests/renderer/harness.mjs loads that renderer in Node; tests/renderer/renderer.test.mjs builds the exampleSite test pages in it and compares each against the golden file the current Hugo's build is compared against. Negative controls: an unguarded hugo.Data, and the same call inside cond, both fail the build; behind a hugo.Version.Compare guard it renders the old branch. pnpm test now runs the renderer test (pnpm test:renderer). @bookshop/hugo-engine is pinned to 3.20.0; its esbuild dependency may not run install scripts. The engine pins liquidjs 10.17.0, which pnpm audit reports with high and critical advisories; an override lifts it to ^10.27.2, and the renderer test never loads liquidjs. The harness require()s an ES module, so it needs Node.js v22.12.0 or later on Node 22. Its header documents that, and how another repo such as hinode or mod-blocks reuses it: copy the file, and add its own exactly pinned @bookshop/hugo-engine devDependency or pass engineDir. A Hugo project's vendored copy of this module leaves tests/ out. Refs gethinode/hinode#2310 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hugo v0.156.0 deprecated site.Data in favour of hugo.Data. The new utilities/GetData.html returns hugo.Data on Hugo v0.156.0 or later and site.Data otherwise. ArgsSchema, GetContact, GetI18nData and GetMenu read their 14 site.Data references through it, as does the exampleSite test runner. The guard is an if/else on hugo.Version.Compare: Bookshop's v0.147.6 live-editing renderer fails on hugo.Data, also inside cond. Tests: a new exampleSite group (data) covers GetContact, GetMenu and GetI18nData; its golden file was generated before the migration. The renderer test covers GetData. tests/deprecations.mjs builds exampleSite at --logLevel info and fails on a .Site.Data deprecation; pnpm test runs it in place of the plain build. Refs gethinode/hinode#2307 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hugo v0.155.0 deprecated Image.Exif in favour of Image.Meta, which reports the EXIF orientation as Meta.Orientation, an int. Hugo's docs give Meta as new in v0.155.3, though v0.155.0 already has it. GetImage reads it from Meta on Hugo v0.155.3 or later and from Exif.Tags.Orientation otherwise, including Bookshop's v0.147.6 live-editing renderer. Tests: new exampleSite groups getimage and getimage-webp render GetImage on a 16x8 fixture with each EXIF orientation 1-8 as JPEG, orientation 6 as PNG, TIFF and WebP, and no EXIF as JPEG, GIF and BMP (generated by exampleSite/assets/img/orientation/generate.py). Their golden files were generated with Exif, before the change, and pass unchanged with Meta. The renderer test builds getimage through a GetResource stub that decodes the fixtures from base64, since the renderer takes no binary files; it skips getimage-webp, since the renderer cannot encode WebP. tests/deprecations.mjs now also fails on an Image.Exif deprecation. Refs gethinode/hinode#2308 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hugo v0.156.0 deprecated site.AllPages. It returns the pages of every language in the first version and the first role of Hugo's sort order, which are the version and role of the first site in hugo.Sites, and not necessarily the default version or role. On Hugo v0.156.0 or later, GetPage builds its fallback match list from the hugo.Sites entries with that version and role; it keeps site.AllPages otherwise, including Bookshop's v0.147.6 live-editing renderer. Tests: exampleSite now has a second language (nl), and a new getpage group resolves references through the permalink fallback: a page that exists only in the other language, its section and home page, a permalink present in both languages (ambiguous, so no match) and a missing one. Its golden file was generated with site.AllPages, before the change, and passes unchanged; the renderer test builds the same group. tests/deprecations.mjs now also fails on a .Site.AllPages deprecation. tests/matrix.mjs builds exampleSite with each config overlay in tests/matrix: two versions, or two roles, whose default is not the first in Hugo's sort order, with every page in each. It compares the getpage group on every site that renders it against tests/matrix/<name>.json, which was generated with site.AllPages. A match against every site's pages, the default site's or the current site's fails it. pnpm test runs it. Refs gethinode/hinode#2309 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 3, 2026
Closed
Collaborator
Author
|
🎉 This PR is included in version 6.18.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Clears the three Hugo deprecations mod-utils emits (
.Site.Data,Image.Exif,.Site.AllPages), and adds a test that runs the partials in CloudCannon's live-editing renderer. Part of gethinode/hinode#2049.CloudCannon's Live Editor renders partials with Bookshop's embedded Hugo v0.147.6, where
hugo.Data,hugo.SitesandImage.Metafail withcan't evaluate field. Each replacement is therefore behind ahugo.Version.Comparecheck, with the old call kept for older Hugo, never insidecond. The module floor (0.146.0) is unchanged.fix: test partials in Bookshop's live-editing renderertests/renderer/loads the real v0.147.6 renderer, builds theexampleSitetest pages in it and compares them with the golden output. Two negative controls (an unguardedhugo.Data, and one insidecond) must fail. Adds aliquidjs@10override sopnpm auditstays clean.fix: read data through a guarded hugo.Data helperutilities/GetData.html; moves all 14site.Datareads to it. hinode and mod-blocks will call it too.fix: read image orientation through a guarded Image.MetaMetaon Hugo 0.155.3 or later.fix: match GetPage references through a guarded hugo.SitesVerification
pnpm testpasses at every commit: deprecation check, 19 golden groups, the versions/roles matrix, and the renderer test (25 pass, 1 skipped: the renderer cannot encode WebP).exampleSiteoutput is identical on every Hugo release from 0.155.0 to 0.169.0, and on 0.147.6. With the versions and roles overlays, it is identical from 0.155.3 to 0.169.0.GetPagereturned the same pages assite.AllPagesin 280 runs: every release from 0.156.0 to 0.169.0, × 10 language, version and role configurations, with drafts on and off.pnpm audit --audit-level=highexits 0.exampleSiteand squadra.nl, built against this branch, give the same output as with v6.18.0, minus theImage.Exifwarning.Not run: the new tests on Windows. The paths and quoting were checked by reading the code.
🤖 Generated with Claude Code