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

Editable redirects #64

Closed
jbmoelker opened this issue Nov 18, 2023 · 1 comment · Fixed by #115 · May be fixed by #232
Closed

Editable redirects #64

jbmoelker opened this issue Nov 18, 2023 · 1 comment · Fixed by #115 · May be fixed by #232
Assignees
Labels
v1 Head Start v1 private

Comments

@jbmoelker
Copy link
Member

jbmoelker commented Nov 18, 2023

User story

As a content editor,
I want to be able to configure redirects in the CMS,
so that I can redirect visitors to a new page when one was removed or deleted or I simply wanted a short url for marketing.

System design

@jbmoelker
Copy link
Member Author

I modelled a quick Redirect Rule model in DatoCMS to test reusing the Internal Link model. However I'm stuck figuring out a simple setup as the multi-locale environment makes it difficult. An Internal Link has a different value for each locale. Whereas a simple redirect rule has the same from and to for each locale. 🤷 :

image

Which prompts this modal when selecting an Internal Link:

image

Notes:

  • We could add a second to model like Redirect Pattern where someone could enter a pattern like: /new/url?filter=:splat.
  • We'll need to add an info box at the top of the model to explain what patterns are supported (:param and * -> :splat).
  • We should add validation to the from value (start with a /, max one *, ...)
  • I do like the radio buttons with help text for the redirect type. The field key is status_code and the radio buttons produce the values 301 and 302.

@jbmoelker jbmoelker added the v1 Head Start v1 private label Dec 17, 2023
@jbmoelker jbmoelker mentioned this issue Jan 18, 2024
9 tasks
@jbmoelker jbmoelker self-assigned this Jan 20, 2024
jbmoelker added a commit that referenced this issue Jan 20, 2024
jbmoelker added a commit that referenced this issue Jan 20, 2024
# Changes

- Adds editable redirects to the CMS (Redirect Rule model).
- Adds postbuild script to download redirects and save to a `_redirects`
file.
- Adds documentation on routing, including redirects.

# Associated issue

Resolves #64

# How to test

1. Review the new Redirect Rules model in the CMS
2. Create or edit Redirect Rules in the CMS (requires rebuild to take
effect)
3. Open the preview deployment
4. Verify that the redirect rules work (also try reordering them):
-
[`/redirect-placeholder/:slug/`](https://ca6875c4.head-start.pages.dev/redirect-placeholder/overview-page/)
->
[`/en/overview-page/`](https://ca6875c4.head-start.pages.dev/en/overview-page/)
-
[`/redirect-wildcard/*`](https://ca6875c4.head-start.pages.dev/redirect-wildcard/overview-page/demos/tables/)
->
[`/en/overview-page/demos/tables/`](https://ca6875c4.head-start.pages.dev/en/overview-page/demos/tables/)
-
[`/redirect-order/*`](https://ca6875c4.head-start.pages.dev/redirect-order/any-slug/)
-> [`/nl/`](https://ca6875c4.head-start.pages.dev/nl/)
-
[`/redirect-order/static-slug/`](https://ca6875c4.head-start.pages.dev/redirect-order/static-slug/)
->
[`/nl/gedeeltelijke-pagina-layouts/`](https://ca6875c4.head-start.pages.dev/nl/gedeeltelijke-pagina-layouts/)

# Checklist

- [x] I have performed a self-review of my own code
- [x] I have made sure that my PR is easy to review (not too big,
includes comments)
- [x] I have made updated relevant documentation files (in project
README, docs/, etc)
- [x] I have added a decision log entry if the change affects the
architecture or changes a significant technology
- [x] I have notified a reviewer

<!-- Please strike through and check off all items that do not apply
(rather than removing them) -->
@jbmoelker jbmoelker mentioned this issue Dec 21, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v1 Head Start v1 private
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant