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

Read-only slug after initial publish #560

Closed
Tracked by #555
mathiazom opened this issue Sep 2, 2024 · 3 comments
Closed
Tracked by #555

Read-only slug after initial publish #560

mathiazom opened this issue Sep 2, 2024 · 3 comments
Assignees

Comments

@mathiazom
Copy link
Contributor

mathiazom commented Sep 2, 2024

Slugs can now be changed easily via Sanity Studio. This risks killing shared links using older versions of the page slug.

Proposed solution: Make slug readonly after initial publish

Proposed solution:
Every time a slug is changed for a page, a redirection rule should be created to redirect the old to the new slug value.

Potential issues:
- Page A changes from /dog to /cat, then page B changes from /cat to /dog. Automatic redirection would redirect /dog to /cat, making page B inaccesible. Or page B would take presedence and the old url for page A would be broken. So a possible solution would be for active slug values to take presedence, while redirection is a fallback. Ideally a warning should be presented when there are conflicts.

@christinaroise
Copy link
Contributor

I wonder if we should look into locking the slug as readonly once it's published. And only handle redirect in the redirect document

@mathiazom
Copy link
Contributor Author

Relevant Sanity guide: https://www.sanity.io/guides/nextjs-automatic-redirects

@mathiazom
Copy link
Contributor Author

Closed by #586

@mathiazom mathiazom changed the title Automatic redirects after slug changes Read-only slug after initial publish Sep 9, 2024
@mathiazom mathiazom self-assigned this Sep 9, 2024
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

No branches or pull requests

2 participants