Closed patrickreiner closed 6 months ago
Hello! 👋
There was a discussion about this on another issue here: https://github.com/withastro/astro/issues/10723#issuecomment-2051625034
In summary: The urls are treated as the same, there is no difference between https://example.com
and https://example.com/
except visual
@BryceRussell Thanks! I somehow missed that issue
@mingjunlu No worries!
@patrickreiner I am going to go ahead and close this since this is expected behavior. If you have any other issues feel free to open another issue 😀
Hi @BryceRussell, thank you, I agree with your label of "nice to have" where it's not breaking anything, but it would be nice to have the visual consistency. @astrojs/sitemap for example used to work like this as well (where the home page always had a trailing backslash) but that behavior was recently corrected as you can see here https://astro-rss-trailing-slash.patrickreiner.com/sitemap-0.xml
You're right! Sorry, I did not realize the sitemap had a similar change recently and did not consider that this could be changed even if it is only visual. For reference, there is a workflow for triaging issues that I try to follow, but I am still learning 😅 I will re-open this issue
It looks like this issue happens because the links are transformed from a string, to a URL
, and then back to a string
Example:
// Returns 'http://example.com/'
new URL('http://example.com').toString()
@BryceRussell That's exactly the reason. I'm willing to work on it if you don't mind 😉
For awareness, the recent change on the sitemap was not just cosmetic like it is here; in that case, it affects SEO by having the canonical URL of a page mismatched between the page and the sitemap.
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
In my astro.config.mjs I set:
export default defineConfig({ ... trailingSlash: 'never', })
and in my vercel.json I set:
{ "cleanUrls": true, ... "trailingSlash": false }
and in my rss.xml.js I set:
export async function GET(context) { return rss({ trailingSlash: false, }) }
and yet, the RSS feed still puts a slash on the home page, viewable here:
http://astro-rss-trailing-slash.patrickreiner.com/rss.xml
What's the expected result?
RSS home page should not have a trailing slash.
Should be:
https://astro-rss-trailing-slash.patrickreiner.com
Not:
https://astro-rss-trailing-slash.patrickreiner.com/
Link to Minimal Reproducible Example
https://github.com/patrickreiner/astro-rss-trailing-slash
Participation