Skip to content

feat: Support language redirection for any docs pages#12

Merged
ogwata merged 4 commits intomainfrom
feat/language-redirection
Feb 2, 2026
Merged

feat: Support language redirection for any docs pages#12
ogwata merged 4 commits intomainfrom
feat/language-redirection

Conversation

@spring-raining
Copy link
Copy Markdown
Member

About

トップページ以外のページについても、language省略時のリダイレクトを有効化します。

  • ex: http://docs.vivliostyle.org/cli/http://docs.vivliostyle.org/ja/cli/
  • ex: https://docs.vivliostyle.org/viewer/vivliostyle-viewer/https://docs.vivliostyle.org/ja/viewer/vivliostyle-viewer/

また、SEO観点で適切なHTMLタグを設定します。(<link rel="canonical">, <link rel="sitemap">)

@spring-raining spring-raining self-assigned this Feb 1, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends language redirection functionality to all documentation pages, not just the homepage. It implements automatic language detection and redirection for any documentation path based on browser preferences, and adds proper SEO tags including canonical links and sitemap references.

Changes:

  • Added availableLanguages prop to all page components to enable language-specific metadata
  • Created new LanguageSwitchLayout component for language detection and redirection
  • Implemented catch-all route [...slug].astro to handle language redirection for any documentation path
  • Updated sitemap configuration to filter and properly handle multi-language pages

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/pages/[...slug].astro New catch-all route that generates language redirect pages for all documentation paths by scanning existing language-specific pages
src/layouts/LanguageSwitchLayout.astro New layout component implementing client-side language detection and redirection logic
src/pages/index.astro Simplified to use the new LanguageSwitchLayout instead of inline redirect code
src/layouts/DocsLayout.astro Added canonical, alternate language, and sitemap link tags; accepts availableLanguages prop
astro.config.mjs Updated sitemap integration to filter language-specific pages and configure i18n settings
src/pages/ja/**/*.astro Added availableLanguages prop to Japanese documentation pages
src/pages/en/**/*.astro Added availableLanguages prop to English documentation pages

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/pages/ja/vfm/[...slug].astro Outdated
Comment thread src/pages/ja/themes/[...slug].astro Outdated
Comment thread src/pages/ja/cli/[...slug].astro Outdated
Comment thread src/layouts/DocsLayout.astro Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Member

@ogwata ogwata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

承認します。全ページでの言語リダイレクト対応とSEOタグの追加、素晴らしいです。Copilotの指摘事項も適切に修正されています。

@ogwata ogwata merged commit 54bef2d into main Feb 2, 2026
3 checks passed
@ogwata ogwata deleted the feat/language-redirection branch February 2, 2026 08:23
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.

3 participants