Skip to content

feat(seo): add URL lang param, dynamic hreflang alternates, and multilingual sitemap - #10

Merged
gzz727007 merged 2 commits into
mainfrom
feat/multilingual-seo
Sep 25, 2026
Merged

gzz727007 merged 2 commits into
mainfrom
feat/multilingual-seo

Conversation

@gzz727007

Copy link
Copy Markdown
Member

🦭 Pull Request Description

Summary of Changes

  1. URL Language Query Parameter & Synchronization (src/i18n.js):

    • Added top-priority URL query parameter parsing (?lang=ja or ?hl=ja) in getInitialLang(), enabling search engine crawlers and users to bookmark or share direct localized links.
    • Automatically synchronizes active language changes to the URL via window.history.replaceState without triggering page reload.
    • Cleans up query parameter when switching back to default English, keeping clean canonical URLs.
  2. Dynamic hreflang Alternates & Canonical URLs (src/utils/seo.js):

    • Injects Google and Bing compliant <link rel="alternate" hreflang="..."> tags for all 6 supported languages (en, de, es, fr, ja, zh, zh-Hans, and x-default).
    • Ensures self-referential canonical links and Open Graph (og:url) tags dynamically match the active localized page URL.
  3. Multilingual sitemap.xml Generator (vite.config.js):

    • Upgraded sitemap generation with the standard xmlns:xhtml="http://www.w3.org/1999/xhtml" specification.
    • Generates 102 indexed multilingual URLs covering all 17 routes (homepage + 16 utilities) with reciprocal xhtml:link alternate annotations and priority weights.
  4. Version Bump & Test Suite Alignment:

    • Bumped version to 1.2.2 across package.json, package-lock.json, and siteConfig.js.
    • Updated test suite origins in tests/routerSeo.test.js and tests/pdfToImage.test.js to match the official site https://pdf.sealkit.org.
    • Added unit test cases for URL language parameter detection and hreflang tag generation (all 36 test suites, 230 tests passing 100%).
    • Updated documentation in README.md and README.zh-CN.md using standard native endonyms terminology.

Type of Change

  • 🐛 Bug fix (non-breaking change fixing an issue)
  • ✨ New feature (non-breaking change adding functionality)
  • ⚡ Performance optimization (rendering, memory, or bundle size)
  • 🎨 UI / UX refinement
  • 🌍 Internationalization / Translations (new or updated language)
  • 📝 Documentation update (README, Guides, Comments)
  • 🧪 Test suite enhancement

🛡️ Privacy & Quality Checklist

  • 100% Client-Side Invariant: All code runs strictly in the browser RAM / WebAssembly. No user documents or telemetry data are ever sent over the network.
  • Automated Tests: I have verified that all existing tests pass (npm test -> 36 suites, 230 tests passing 100%).
  • New Tests Added: Added hreflang and URL search parameter tests in tests/routerSeo.test.js.
  • Responsive & Cross-Browser: Verified that UI works smoothly across desktop and mobile screens.
  • Self-Review: I have performed a self-review of my own code and removed unnecessary console.log statements.

Related Issues

Closes #

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
pdfseal 5317072 Commit Preview URL

Branch Preview URL
Sep 25 2026, 08:04 AM

@gzz727007
gzz727007 merged commit e5f3652 into main Sep 25, 2026
4 checks passed
@gzz727007
gzz727007 deleted the feat/multilingual-seo branch September 25, 2026 08:07
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