-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Generating a sitemap for [...slug].astro pages with slugs starting with / results in broken URLs #9946
Comments
I'm not sure if slugs should have a leading slash or trailing slash, I feel like there would be more bugs down the line if you do so, and not just an issue with the sitemap integration 🤔 |
What kind of bugs? We use leading slashes in our application and everything works except generating sitemap. That's why I think it's the issue with the sitemap integration. If using leading or trailing slashes was forbidded there should be any validation while generating static paths or there should be a note in a documentation that you can't use this kind of slashes in the code with explanation. |
I agree with @bluwy, I didn't think leading slashes would be allowed as parameters. Not sure what's the best way here, maybe we should do the following:
|
@florian-lefebvre, where should this warning be printed? |
I'm not 100% sure when this runs in Astro, but basically as soon as we get the result of the |
@matthewp what do you think? Does it make sense to you? |
I think @florian-lefebvre's plan makes sense. There was a related issue where someone was confused today. |
After discussing this we realized that having double slashes is valid in a URL path, ( Another idea that could help is having a utility like |
Closing. This will be fixed in Astro v5. Follow #7962 (comment) for more information. Params can contain slashes, but they must be encoded inside |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
I am creating my own integration with CMS and I've decided to store all slugs inside content management system. Thus, my
pages
folder contains only one page -[...slug].astro
. I have complicated logic ingetStaticPaths
but it migth be simplified to this:Let's assume my
astro.config.mjs
looks like:In this case I get sitemap:
What's the expected result?
I expect sitemap to be:
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-e5zwsf?file=dist%2Fsitemap-0.xml
Participation
The text was updated successfully, but these errors were encountered: