fix(docs): redirect /gh-aw (no trailing slash) to /gh-aw/#21906
fix(docs): redirect /gh-aw (no trailing slash) to /gh-aw/#21906
Conversation
…thout trailing slash Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> Agent-Logs-Url: https://github.com/github/gh-aw/sessions/f9d37da5-7c36-47ca-9063-bc6382bc4055
There was a problem hiding this comment.
Pull request overview
Updates the Astro docs site configuration to ensure requests to the base path without a trailing slash (e.g., /gh-aw) resolve to the canonical trailing-slash URL (/gh-aw/), avoiding a 404 and incorrect canonical URL rendering.
Changes:
- Set
trailingSlash: 'always'in the Astro config to enforce trailing-slash canonical URLs (and redirect slashless paths).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export default defineConfig({ | ||
| site: 'https://github.github.com', | ||
| base: '/gh-aw/', | ||
| trailingSlash: 'always', |
There was a problem hiding this comment.
This config change introduces an important routing/redirect behavior but there’s no regression test covering it. Since this repo already runs Playwright against the dev server (see docs/playwright.config.ts), please add a Playwright test that navigates to /gh-aw (no trailing slash) and asserts it redirects/lands on /gh-aw/ (and ideally that it’s not the 404 page / canonical URL is correct). This will prevent the base-path 404 + doubled-canonical regression from reappearing.
GET /gh-awreturned 404 instead of redirecting to/gh-aw/, and the resulting 404 page rendered a doubled canonical URL (https://github.github.com/gh-aw/gh-aw/).Change
Added
trailingSlash: 'always'todocs/astro.config.mjs:This instructs Astro to redirect any no-trailing-slash path to its canonical trailing-slash form — covering both the dev server and static build output. Fixes the base path 404 and the bad canonical URL as a consequence (the 404 page is no longer served for
/gh-aw). No other pages are affected since all existing links already use trailing slashes.💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.