From f0a9ebd2e812e8b0f3a50f35d39ed9a8b2026f7c Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Thu, 11 Jun 2026 17:44:49 -0400 Subject: [PATCH 1/5] Update Docsy theme module to main (post-#2647) --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index c4fc3bcf21..3a2188871e 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/google/docsy-example go 1.12 -require github.com/google/docsy/theme v0.0.0-20260530181410-94f94145fe15 // indirect +require github.com/google/docsy/theme v0.0.0-20260611213000-5c5733de6062 // indirect diff --git a/go.sum b/go.sum index 4e10ac0b75..69bc01e796 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ github.com/FortAwesome/Font-Awesome v0.0.0-20241216213156-af620534bfc3 h1:/iluJkJiyTAdnqrw3Yi9rH2HNHhrrtCmj8VJe7I6o3w= github.com/FortAwesome/Font-Awesome v0.0.0-20241216213156-af620534bfc3/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo= -github.com/google/docsy/theme v0.0.0-20260530181410-94f94145fe15 h1:ZvwTrXGvb54wT1ajJnnFcepHZnW9R3sypzhAIlGfFps= -github.com/google/docsy/theme v0.0.0-20260530181410-94f94145fe15/go.mod h1:CGCFFJjc3PAYexPDsQqTbB3/lWnncwlwKLnSQkDaaF0= +github.com/google/docsy/theme v0.0.0-20260611213000-5c5733de6062 h1:Wm1KR34lrCA0DLlTfVaVaSNl9IoCFd8Dw7vKiH+5Zqc= +github.com/google/docsy/theme v0.0.0-20260611213000-5c5733de6062/go.mod h1:CGCFFJjc3PAYexPDsQqTbB3/lWnncwlwKLnSQkDaaF0= github.com/twbs/bootstrap v5.3.8+incompatible h1:eK1fsXP7R/FWFt+sSNmmvUH9usPocf240nWVw7Dh02o= github.com/twbs/bootstrap v5.3.8+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0= From 563765513619f0cb7ccacb7724331b2d50c69e90 Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Thu, 11 Jun 2026 17:45:30 -0400 Subject: [PATCH 2/5] Migrate off deprecated language config keys and .Sites - hugo.yaml: languageName -> label, languageDirection -> direction - layouts/home.redirects: .Sites -> hugo.Sites (deprecated in 0.156.0) Build now logs zero deprecation notices at --logLevel info. --- layouts/home.redirects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/home.redirects b/layouts/home.redirects index 336493edf5..691b6f430d 100644 --- a/layouts/home.redirects +++ b/layouts/home.redirects @@ -5,7 +5,7 @@ Adapted from https://gohugo.io/methods/page/aliases/#template-implementation cSpell:ignore hugo */ -}} -{{ range .Sites -}} +{{ range hugo.Sites -}} {{ range $p := .Pages -}} {{ range .Aliases -}} {{ if findRE `\s` . -}} From d06cc5707f354ef6bb6468d1c6c259ac433f9bba Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Thu, 11 Jun 2026 17:49:20 -0400 Subject: [PATCH 3/5] Add site tests: language selector and RTL rendering - tests/site.test.mjs validates the generated site: disabled menu entries for untranslated languages, links to existing translations, and dir=rtl/lang=fa on Persian pages - Wire test:site into the test-only chain --- package.json | 3 ++- tests/site.test.mjs | 57 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 tests/site.test.mjs diff --git a/package.json b/package.json index 11f780b085..463ce8a98b 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,8 @@ "seq": "bash -c 'for cmd in \"$@\"; do npm run $cmd || exit 1; done' - ", "serve": "npm run _serve", "test-and-fix": "npm run fix && npm run test-only", - "test-only": "npm run check:links", + "test-only": "npm run check:links && npm run test:site", + "test:site": "node --test 'tests/**/*.test.mjs'", "test": "npm run test-and-fix", "update:docsy:main": "hugo mod get -u github.com/google/docsy/theme@main && hugo mod tidy", "update:docsy:mod": "hugo mod get -u github.com/google/docsy/theme && hugo mod tidy", diff --git a/tests/site.test.mjs b/tests/site.test.mjs new file mode 100644 index 0000000000..6f054a1b39 --- /dev/null +++ b/tests/site.test.mjs @@ -0,0 +1,57 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { readFileSync } from 'node:fs'; +import { join } from 'node:path'; +import { fileURLToPath } from 'node:url'; + +// Validates the navbar language selector and RTL rendering in the generated +// site (public/). Assumes the site has been built (`npm run build`); in the +// `test-only` chain, the check:links prebuild takes care of that. + +const publicDir = fileURLToPath(new URL('../public', import.meta.url)); + +function page(relPath) { + return readFileSync(join(publicDir, relPath, 'index.html'), 'utf8'); +} + +// Extract the language-menu markup from a page. +function langMenu(html) { + const m = html.match( + /