Skip to content

feat: redirect to new curriculum paths#4

Merged
moT01 merged 3 commits intofreeCodeCamp:masterfrom
ojeytonwilliams:feat/add-redirection
Aug 13, 2021
Merged

feat: redirect to new curriculum paths#4
moT01 merged 3 commits intofreeCodeCamp:masterfrom
ojeytonwilliams:feat/add-redirection

Conversation

@ojeytonwilliams
Copy link
Contributor

The order of redirects matters - the specific urls (without "routing segments" like :block) must come before the more general urls.

The order of redirects matters - the specific urls (without "routing
segments" like :block) must come before the more general urls.
serve.json Outdated
Comment on lines +41 to +42
"source": "/learn/front-end-libraries/:block",
"destination": "/learn/front-end-development-libraries/:block"
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this one come later then? It's less specific than ones below it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question. Order only seems to matter when the number of path segments match. So, since all the following sources are longer (or completely different) it doesn't matter.

Copy link
Member

Choose a reason for hiding this comment

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

There's definitely some magic going on there that I'd worry about breaking later lol

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's fairly light magic, tbh. It just checks a path against the array of redirects and uses the first redirect that matches. The only subtlety is that if two redirects could match a given path, you have to put the redirect you want first.

Also, I've added a bunch of tests to the CI, so we should find out if this breaks.

I don't know why source: "/:segment*", destination: "/:segment*" does
not work, but optional segments do.
Copy link
Member

@naomi-lgbt naomi-lgbt left a comment

Choose a reason for hiding this comment

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

This should be good, I think.

Copy link
Member

@moT01 moT01 left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

@moT01 moT01 merged commit a3c26df into freeCodeCamp:master Aug 13, 2021
@ojeytonwilliams ojeytonwilliams deleted the feat/add-redirection branch August 13, 2021 17:05
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.

3 participants