Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change redirect logic #85

Merged
merged 1 commit into from
Dec 24, 2024
Merged

Change redirect logic #85

merged 1 commit into from
Dec 24, 2024

Conversation

ptgott
Copy link
Contributor

@ptgott ptgott commented Dec 23, 2024

When Docusaurus detects a section index page - in which the slug matches the second-to-last URL path segment - it produces a route for the page with only the second-to-last path segment, omitting the slug. When migrating to the Docusaurus site, we added redirects from paths with the format /slug/slug/ to /slug/.

This change edits these redirects progammatically to reverse the source/destination mappings. If a redirect only maps a Docusaurus-style slug to a pre-migration index page slug, the docs engine rewrites it to map the pre-migration slug to a Docusaurus-style one.

For redirect destinations that use pre-migration slugs, this change adjusts them to be Docusaurus-style slugs (this is the current redirect rewriting behavior).

When Docusaurus detects a section index page - in which the slug matches
the second-to-last URL path segment - it produces a route for the page
with only the second-to-last path segment, omitting the slug. When
migrating to the Docusaurus site, we added redirects from paths with the
format `/slug/slug/` to `/slug/`.

This change edits these redirects progammatically to reverse the
source/destination mappings. If a redirect only maps a Docusaurus-style
slug to a pre-migration index page slug, the docs engine rewrites it to
map the pre-migration slug to a Docusaurus-style one.

For redirect destinations that use pre-migration slugs, this change
adjusts them to be Docusaurus-style slugs (this is the current redirect
rewriting behavior).
Copy link

github-actions bot commented Dec 23, 2024

Amplify deployment status

Branch Commit Job ID Status Preview Updated (UTC)
paul.gottschling/2024-12-23-redirs 15441e3 6 ✅SUCCEED paul-gottschling-2024-12-23-redirs 2024-12-23 20:08:16

@ptgott ptgott merged commit 3f68d6c into main Dec 24, 2024
4 checks passed
@ptgott ptgott deleted the paul.gottschling/2024-12-23-redirs branch December 24, 2024 13:44
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