Skip to content

Kit: let a site point the language link at its own page - #54

Merged
emptymalei merged 1 commit into
hugofrom
claude/kit-lang-links
Oct 3, 2026
Merged

emptymalei merged 1 commit into
hugofrom
claude/kit-lang-links

Conversation

@emptymalei

Copy link
Copy Markdown
Member

Requested by L · project thread

Before: on any site that uses the shared kit header, the 中文 / English link always went to the interimm.org home page in the other language. On the cities explorer, switching language therefore took visitors off the explorer.

After: a site can add data-lang-cn="…" or data-lang-en="…" to its data-interimm-header, and the language link goes to that URL. Sites that don't set it keep today's behaviour, so the change is additive.

How: nav.<lang>.json now has a lang key (cn/en) on each language entry, and interimm.js checks the header for a matching data-lang-* attribute before falling back to the home page URL. kit/README.md documents the option and adds a short caching note: Pages caches for about 10 minutes, so sites should version-stamp their own assets on each deploy. I tested a sample page with and without the attribute, using a local build of the kit. The link went to the given URL and to https://interimm.org/ respectively, and there were no script errors.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EZdfMMy2aM8X4PGqUv2p7N


Generated by Claude Code

A header with data-lang-cn / data-lang-en now sends the 中文 / English link
to that URL instead of the interimm.org home page, so sub-sites with their
own translations keep visitors on the same site. nav.<lang>.json gains a
"lang" key per language for this. Also notes caching and asset version
stamps in kit/README.md.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EZdfMMy2aM8X4PGqUv2p7N
@emptymalei emptymalei self-assigned this Oct 3, 2026
@emptymalei
emptymalei merged commit 275d228 into hugo Oct 3, 2026
2 checks passed
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.

2 participants