feat: redirect to new curriculum paths#4
Conversation
The order of redirects matters - the specific urls (without "routing segments" like :block) must come before the more general urls.
serve.json
Outdated
| "source": "/learn/front-end-libraries/:block", | ||
| "destination": "/learn/front-end-development-libraries/:block" |
There was a problem hiding this comment.
Shouldn't this one come later then? It's less specific than ones below it.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
There's definitely some magic going on there that I'd worry about breaking later lol
There was a problem hiding this comment.
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.
naomi-lgbt
left a comment
There was a problem hiding this comment.
This should be good, I think.
The order of redirects matters - the specific urls (without "routing segments" like :block) must come before the more general urls.