Repository navigation
Fix Markdown page actions on untranslated locale pages - #1990
David Pine (IEvangelist) merged 1 commit into
Conversation
…Markdown Fallback (untranslated) locale pages render the default-locale content, but the starlight-page-actions Copy Markdown and View as Markdown actions used the localized pathname, so they requested /<locale>/<slug>.md files that are never emitted and returned 404. Co-authored-by: Copilot <[email protected]>
Frontend HTML artifact readyThe latest frontend build uploaded the This comment updates automatically when a new frontend build artifact is uploaded. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the fallback-locale Markdown action changes.
No open issues 🎉
What changed in this PR
Fixes Copy Markdown and View as Markdown on untranslated locale pages by pointing them to the default-locale Markdown that matches the displayed content. Translated pages retain their localized Markdown URLs.
Changes:
- Updates the page-actions patch to remove the locale prefix for fallback pages.
- Adds regression coverage for fallback and translated pages, including action URLs, Markdown responses, and copied content.
- Documents the expanded patch behavior.
| File | Description |
|---|---|
src/frontend/tests/e2e/api-markdown-routes.spec.ts |
Tests Markdown actions on German fallback and Japanese translated pages. |
src/frontend/patches/[email protected] |
Corrects fallback Markdown paths for copy buttons and view links. |
src/frontend/patches/README.md |
Records the patch’s fallback-locale handling. |
Review effort: Balanced
|
David Fowler (@davidfowl), can we get a PR into the starlight-page-actions repo for these changes so that we can eventually not rely on the patch, but rather the official release again? |
Documentation applicability reviewReviewed all three changed files at Phase A - Claim verification: not applicable. There are no changed Aspire API, CLI, configuration, integration, or version-guidance claims to verify against microsoft/aspire, CommunityToolkit/Aspire, or Azure/azure-sdk-for-net. Applicable claims: 0; verified / nuanced / unverifiable / contradicted: 0 / 0 / 0 / 0. No external source repository was needed. The single maintenance README edit describes the dependency patch; its behavior belongs to the code review, not Aspire product-claim verification. Phase B - Blind documentation testing: not applicable. No documentation page, tutorial, or example content changed, so there are no affected documentation sections to exercise as a new Aspire user. No doc-tester or unrelated documentation routes were run; this is an applicability result, not a claim that browser tests passed. The localized page-action behavior and new regression test are assessed separately in the code stage. Phase C - Result: documentation applicability assessment complete; no documentation-accuracy findings. This conversation comment is not an approval or change-request verdict. |
Project code reviewReviewed No actionable high-confidence findings. The change looks correct and adequately covered for this site's configuration (root default locale, no deployment base path). I applied the complete PR patch to the published Test coverage and verification
No local production build was run. No PR files were changed, and this conversation comment is not an approval or change-request verdict. |
## Summary
Fixes seven broken internal links in the English docs. Every locale
falls back to these pages, so each broken link appears on all 15
locales. The links validator didn't flag them because it never inspects
these two kinds of link:
- `starlight-links-validator` runs with `errorOnRelativeLinks: false`,
so it skips `./` and `../` links entirely.
- It only reads string `href` attributes. It can't see hrefs passed
through JSX expression props such as `cta={{ href: '…' }}` or
`capabilities={[{ href: '…' }]}`.
| Page | Link | Before | After |
|---|---|---|---|
| `/dashboard/` (2 `ImageShowcase` CTAs + 3 `CapabilityGrid` cards) |
Tracing / Structured logs / Metrics | `/dashboard/explore/#traces`,
`#structured-logs`, `#metrics`. These ids don't exist, so the link lands
at the top of a long page | `#traces-page`, `#structured-logs-page`,
`#metrics-page`, the same anchors that `dashboard/standalone.mdx` and
`data/dev-hub.ts` already use |
| `/reference/cli/commands/aspire-dashboard-run/` | Dashboard
configuration | `../../../dashboard/configuration/` →
`/reference/dashboard/configuration/` (**404**) |
`/dashboard/configuration/` |
| `/integrations/cloud/azure/azure-cache-redis/azure-cache-redis-host/`
| Redis Hosting integration |
`../../../caching/redis/redis-host/#…-redis-insights` →
`/integrations/cloud/caching/redis/redis-host/` (**404**), and the
anchor was misspelled |
`/integrations/caching/redis/redis-host/#add-redis-resource-with-redis-insight`
|
The fixed links are absolute, so `starlight-links-validator` now checks
the two Markdown ones at build time. A new unit test,
`tests/unit/docs-internal-links.vitest.test.ts`, covers the gap for the
English docs. It resolves expression-prop `href:` values and `./`/`../`
Markdown links to an existing docs page and, when there's a fragment, to
an existing heading id. It follows the existing pattern in
`dev-glossary.vitest.test.ts` and slugs headings with `github-slugger`,
as Starlight does. Like the validator config, it skips `/reference/api/`
and `/hub/`.
### How this was found
I crawled main's CI `frontend-dist` artifact, the production build of
`29550055` from [run
41062457941](https://github.com/microsoft/aspire.dev/actions/runs/41062457941),
covering all 8,327 non-API HTML pages. I checked every internal `<a
href>` against the built files and ids. Before this change the live site
behaves as follows:
- `https://aspire.dev/reference/dashboard/configuration/` returns 404.
- `https://aspire.dev/integrations/cloud/caching/redis/redis-host/`
returns 404.
- `https://aspire.dev/dashboard/explore/` only has `id="traces-page"`,
`id="structured-logs-page"` and `id="metrics-page"`.
The crawl also found broken links that this PR leaves alone:
- Localized `.md` page-action links: covered by #1990.
- Localized glossary links: covered by #1989.
- Bare relative links in `whats-new/aspire-9-4.mdx` and
`aspire-9-5.mdx`: these files are being edited by open PRs #1933, #1896
and #1876.
- A typo in a synced sample README (`data/samples.json`): it comes from
the upstream samples repo.
## Third-party links and affiliations
None.
## Validation
- The regression test fails before the fix with exactly the 7 links
above, and passed in 3 of 3 runs after it. Before-fix output:
```
dashboard/index.mdx: /dashboard/explore/#traces points to a missing
heading #traces (×2)
dashboard/index.mdx: /dashboard/explore/#structured-logs points to a
missing heading #structured-logs (×2)
dashboard/index.mdx: /dashboard/explore/#metrics points to a missing
heading #metrics
integrations/cloud/azure/azure-cache-redis/azure-cache-redis-host.mdx:
../../../caching/redis/redis-host/#add-redis-resource-with-redis-insights
resolves to missing page /integrations/cloud/caching/redis/redis-host/
reference/cli/commands/aspire-dashboard-run.mdx:
../../../dashboard/configuration/ resolves to missing page
/reference/dashboard/configuration/
```
- On the 538 English docs the test reports nothing besides these 7, and
its findings match the built-output crawl for the link kinds it covers.
- `npx vitest run`: 84 files passed; 1,121 tests passed and 1 skipped.
- `npx eslint . --max-warnings 0` passes, and the new test file is
Prettier-formatted.
- Browser check with Playwright against `astro dev`, after the fix:
- `/dashboard/` renders the five `#*-page` hrefs, and each target id
exists on `/dashboard/explore/`.
- The Dashboard configuration link returns 200.
- The Redis Hosting integration link returns 200, and its anchor exists.
- No visual change: only the link targets change, so the rendered pages
are pixel-identical and there are no screenshots.
**🤖 Posted by AspireAgent (AI Agent)**
---------
Co-authored-by: davidfowl <[email protected]>
Co-authored-by: Copilot <[email protected]>
David Pine (IEvangelist)
left a comment
There was a problem hiding this comment.
Approved following the completed Project docs applicability and clean code review at this unchanged head, approval recommendation, and passing CI. Approval and merge authorized by the user.
Summary
On untranslated (fallback) locale pages, the Copy Markdown and View as Markdown page actions are broken. These pages show the English content, but
starlight-page-actionsbuilds the Markdown URL from the localized pathname (/de/fundamentals/telemetry.md). Only real source files are copied as.md, so that URL returns 404. Copy Markdown shows its error state, and View as Markdown opens a 404 page. Most locales only translateindex.mdx, so this affects thousands of pages.Live evidence (curl, aspire.dev):
/de/fundamentals/telemetry.md→ 404,/de/get-started/install-cli.md→ 404,/fr/get-started/install-cli.md→ 404/fundamentals/telemetry.md→ 200,/ja/fundamentals/telemetry.md→ 200 (this page is translated)Root cause:
PageActions.astrousesAstro.url.pathnamefor the copydata-path, the TOCdata-pathand the view href, without checkingstarlightRoute.isFallback.Fix (in the existing
patches/[email protected]): whenisFallbackis true, strip the/<locale>prefix so the actions point to the default-locale Markdown for the content that is actually shown. Translated pages are unchanged.Third-party links and affiliations
None
Validation
api-markdown-routes.spec.ts. It checks/de/(fallback) and/ja/(translated) telemetry pages: the action paths and hrefs, that the.mdfile returns 200text/markdown, and that clicking Copy Markdown puts the expected heading on the clipboard./fundamentals/telemetry, received/de/fundamentals/telemetry).api-markdown-routes,mobile-uxMarkdown copying), desktop and mobile: 28 passed, 2 skipped (skips declared in the spec).vitest: 82 files, 1108 passed, 1 skipped. Lint (astro sync, skill digest check,eslint --max-warnings 0): clean. Prettier on the spec: clean.🤖 Posted by AspireAgent (AI Agent)