Repository navigation
Set up redirects based on 404 data & filter sitemap - #1976
Conversation
✅ Deploy Preview for astro-docs-2 ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
| const { lang } = Astro.params; | ||
| --- | ||
|
|
||
| <meta http-equiv="refresh" content={`0;url=/${lang}/tutorial/0-introduction/`} /> |
There was a problem hiding this comment.
Will this show up in the sitemap?
There was a problem hiding this comment.
Excellent question. The answer is: yes!
https://deploy-preview-1976--astro-docs-2.netlify.app/sitemap-0.xml
We can filter sitemap URLs I believe. Let me look at that — we should probably exclude our other similar redirects too. (Probably doesn’t matter too much — these redirect pages are completely empty so are very unlikely to be indexed, but still.)
There was a problem hiding this comment.
OK, question back time: does it matter if it is in sitemap?
There was a problem hiding this comment.
Its usually best to keep redirects out of the sitemap, but that can be tackled in a separate PR 👍
Its really not a huge deal in general, I think it's pretty common for redirects to linger in a sitemap for a while (or forever on some sites)
There was a problem hiding this comment.
OK — pushed a fix for the low-hanging fruit here. Our [lang]/something.astro redirects like the one added in this PR are easy to filter out. Other dynamic redirects in the root of src/pages/ will be trickier and can be tackled later I guess (or refactored to be configured in netlify.toml).
There was a problem hiding this comment.
Engaged morning brain and implemented a much better filtering set-up so now the sitemap shouldn’t include any of our redirect routes!
|
No objections here, once you're happy @delucis ! Just putting it on the radar that since we've discussed adding additional content in the "Tutorials" section, maybe it's time for @Jutanium and I to start discussing/sketching out a generic tutorial landing page anyway? I think this could fit in next sprint, actually! |
| /** Get a preconfigured instance of the `@astrojs/sitemap` integration. */ | ||
| export function sitemap(): AstroIntegration { | ||
| return AstroSitemap({ | ||
| filter: (page) => isValidPath(new URL(page).pathname), |
What kind of changes does this PR include?
Description
Add a Netlify redirect for an old
renderer-referenceURLAdd a route with a
<meta>refresh redirect for/[lang]/tutorialWe may one day have an actual
/tutoriallanding page potentially, so using a.astroroute with<meta>seemed safer than configuring a Netlify redirect we’d be more likely to forget to remove.Testing
These URLs were 404s but should now work: