-
Notifications
You must be signed in to change notification settings - Fork 4
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
v3 - manual Sanity-controlled redirects #562
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
TODO: add documentation |
b140f11
to
e125198
Compare
Should we even allow adding permanent redirects? These can not be undone realiably since they are stored on the client. |
Nice! Det som kanskje kunne vært nyttig hadde vært å referere til de sidene vi har? Så i stedet for å skrive inn manuelt så kan man velge page (slik som man gjør i navigation manager). I tillegg bør man kanskje vurdere om man skal kunne legge til flere redirects på samme redirect? |
Veldig godt poeng 👍 Er det fortsatt interessant å kunne skrive inn manuelt, eller kun Sanity pages? |
Mener du at flere source paths kan peke til samme destination path? F.eks. Det er absolutt en mulighet 👍 |
Hmm, er det mulig å la brukeren skrive inn, men at det gir feil hvis det ikke finnes en page? Og filtrere bort de som ikke er aktuelle i dropdown-menyen. Da unngår man brukerfeilen ved å redirecte til en page som ikke finnes. |
Ja stemmer! |
Laget et forslag til løsning nå, se bilder over. Her velger du om du ønsker å bruke en referanse til en intern side, eller en statisk slug. Feltet under typen vil da vise felt for slug eller intern side avhengig av typevalget. |
7adc9c0
to
14ee80a
Compare
14ee80a
to
9fbe8e7
Compare
Decided to omit support for permanent redirects for now. This can be introduced later if needed. |
can be introduced later if needed, but omitted now because they are hard to undo later
to avoid token leaking to client (even though middleware should run on server...)
c553382
to
bd4e5e0
Compare
5c73e10
to
971cdc7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
Further explanation is found here: #561
Added support for defining temporary redirects from Sanity Studio. Redirect destination can be either a reference to a page defined in Sanity, or an external URL. Support for a static internal slug has not been added, but might be introduced in the future.
Redirects are performed in a Next.js middleware. Using a middleware ensures that all redirects are up-to-date, but will likely reduce performance. The alternative is a redirects list generated at build-time. This will likely improve performance, but has the disadvantage of outdated redirects between builds. This could be adressed by adding some type of hook that would trigger a rebuild when new slugs are published.
Visual Overview (Image/Video)
Page reference:
External URL:
Checklist
Please ensure that you’ve completed the following checkpoints before submitting your pull request: