Kit: let a site point the language link at its own page - #54
Merged
Merged
Conversation
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
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.
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="…"ordata-lang-en="…"to itsdata-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>.jsonnow has alangkey (cn/en) on each language entry, andinterimm.jschecks the header for a matchingdata-lang-*attribute before falling back to the home page URL.kit/README.mddocuments 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 tohttps://interimm.org/respectively, and there were no script errors.🤖 Generated with Claude Code
https://claude.ai/code/session_01EZdfMMy2aM8X4PGqUv2p7N
Generated by Claude Code