Skip to content

fix(website): correct next/previous links on release notes pages#11358

Draft
timotheeguerin wants to merge 3 commits into
mainfrom
fix/website-release-notes-next-prev
Draft

fix(website): correct next/previous links on release notes pages#11358
timotheeguerin wants to merge 3 commits into
mainfrom
fix/website-release-notes-next-prev

Conversation

@timotheeguerin

Copy link
Copy Markdown
Member

Fixes #10690

Problem

At the bottom of a release notes page (e.g. typespec-1-12-0) the next/previous links were wrong: the "previous" link pointed to the wrong version and a spurious "next" link appeared on the latest release.

Root cause

Starlight derives prev/next pagination from the flattened sidebar order (getPrevNextLinks). The release notes group uses autogenerate: { directory: "release-notes" }, which orders entries alphabetically by slug — so typespec-1-12-0 is followed by typespec-1-2-0 (1.2.0), and typespec-1-1x-0 sort before typespec-1-2-0.

The existing Sidebar.astro override only re-sorted the visual sidebar newest-first; it never touched pagination, so the sidebar and the prev/next links disagreed.

Starlight's built-in autogenerate ordering only supports sidebar.order (ascending) + alphabetical — there is no date/descending sort. And even if there were, pagination follows the sidebar in a single direction, whereas we need the sidebar newest-first but pagination prev=older/next=newer. So custom pagination logic is required.

Fix

Add a Starlight route middleware (website/src/starlight-route-data.ts, the documented mechanism for customizing route data) that, for release notes pages:

  • sorts the release notes sidebar group newest-first by releaseDate, and
  • recomputes pagination chronologically — previous = older release, next = newer release, with no next on the newest and no previous on the oldest.

Ordering now has a single source of truth, so the redundant sort block was removed from Sidebar.astro.

Verification

Built the site and inspected the generated HTML:

Page previous next
typespec-1-12-0 typespec-1-11-0 typespec-1-13-0
typespec-1-14-0 (latest) typespec-1-13-0 (none)
cadl-typespec-migration (oldest) (none) release-2022-07-08
  • Non-release-notes docs pages: pagination unchanged.
  • astro check: 0 errors.

No changelog entry — @typespec/website is a private package excluded from Chronus.

Release notes pages showed wrong prev/next links: Starlight derives pagination from the autogenerated sidebar order, which sorts release notes alphabetically by slug (so typespec-1-12-0 was followed by typespec-1-2-0).

Add a Starlight route middleware that, for release notes pages, orders the release notes chronologically by releaseDate: the sidebar shows newest-first while pagination points to the correct previous (older) and next (newer) release, with no next on the latest and no previous on the oldest.

Fixes #10690
@microsoft-github-policy-service microsoft-github-policy-service Bot added the meta:website TypeSpec.io updates label Jul 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

No changes needing a change description found.

@azure-sdk-automation

azure-sdk-automation Bot commented Jul 22, 2026

Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

meta:website TypeSpec.io updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: website shows incorrect next/previous links at the bottom of release notes

1 participant