Skip to content

ci: fix docs preview link for relative frontmatter slugs#2836

Open
jwhartley wants to merge 1 commit intomasterfrom
fix/docs-preview-relative-slug-2
Open

ci: fix docs preview link for relative frontmatter slugs#2836
jwhartley wants to merge 1 commit intomasterfrom
fix/docs-preview-relative-slug-2

Conversation

@jwhartley
Copy link
Copy Markdown
Contributor

Summary

Fixes incorrect preview links for docs files that use a relative slug in their frontmatter.

Docusaurus resolves relative slugs (no leading /) from the file's directory. For example, slug: installation in site/docs/getting-started/installation.md produces the URL /getting-started/installation — not /installation.

The preview link script was prepending / directly, producing the wrong URL. Caught on #2827.

Fix: when the slug doesn't start with /, construct the full path using the file's directory.

Test plan

  • Backtested against 4 real docs files with varying slug patterns (relative, absolute, root /, no slug) — all resolve correctly
  • The bug case: getting-started/installation.md with slug: installation/getting-started/installation
  • Absolute slug (slug: /) → unchanged ✓
  • No slug → falls back to file path derivation ✓

Docusaurus resolves relative slugs (no leading /) from the file's
directory. e.g. `slug: installation` in getting-started/installation.md
becomes /getting-started/installation, not /installation.

The preview link script was prepending / directly, producing the wrong
URL for files with relative slugs. Caught on #2827.
@jwhartley jwhartley requested a review from aeluce April 8, 2026 07:24
@jwhartley jwhartley assigned jwhartley and unassigned aeluce Apr 8, 2026
Copy link
Copy Markdown
Collaborator

@aeluce aeluce left a comment

Choose a reason for hiding this comment

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

🙌

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.

2 participants