philnash / astro-components

A collection of Astro components
MIT License
21 stars 0 forks source link

Trailing Slash on the first page of pagination #4

Closed tiwka19 closed 1 year ago

tiwka19 commented 1 year ago

If you paste a slash in the url on the first page of pagination, the page will not give 404. So that /articles/ and /articles// will be indexed.

philnash commented 1 year ago

Thanks for the report, and sorry I only just saw this. I will take a look into this.

tiwka19 commented 1 year ago

Thanks for the report, and sorry I only just saw this. I will take a look into this.

I'm sorry, but when are you going to be able to fix this?

philnash commented 1 year ago

Thanks for the reminder @tiwka19. I just took a look at this and I don't think it's an issue with this plugin. This plugin only generates pagination links, it doesn't handle responding to URLs. That is up to your web host/server and Astro itself.

I had a quick look around and CloudFlare offers ways to normalize URLs, there are long guides on this for Netlify (and notably, Astro's blog itself is hosted on Netlify and 301 redirects if you enter multiple trailing slashes) and I found a blog post on how to handle this if hosting Astro sites on Vercel.

I am confident this is an issue between Astro and wherever you host your application, so I'm going to close this. If you have further thoughts or ideas on why this plugin might be responsible, please feel free to re-open. Thanks!