jonasmerlin / astro-seo

Makes it easy to add information that is relevant for SEO to your Astro app.
MIT License
908 stars 50 forks source link

Setting Astro trailingSlash to never still sets canonical url to url with a 'trailing slash' #76

Closed gvkhna closed 6 months ago

gvkhna commented 11 months ago

I just tested this by setting setting astro.config.ts, trailingSlash: 'never'. But i'm still getting <link rel="canonical" href="http://localhost:8080/blog/page/" in build output. This seems like a bug to me.

Semi-related issue that others might be experiencing related to this issue: https://github.com/withastro/astro/issues/7808

jonasmerlin commented 11 months ago

@gvkhna Thanks for your feedback!

The code producing the tag looks like this:

<link rel="canonical" href={Astro.props.canonical || Astro.url.href} />

So really, we either use exactly what you pass in yourself or what Astro itself gives us. My call would be to keep it this way and see if Astro changes their API to do what you describe.

Does that sound reasonable to you or would you handle this differently?

gvkhna commented 11 months ago

I believe they did identify an issue with the node adapter in the issue. Hopefully this will be resolved upstream.

jonasmerlin commented 11 months ago

@gvkhna Great. Please feel free to keep me in the loop on this one on here, as I don't have much time these days to keep track of these things. So if this is resolved I would be happy about a ping as well as if I have to change anything on asto-seo's end.

gvkhna commented 11 months ago

You got it yea i’m tracking with this.

0xtimsb commented 9 months ago

Any updates on this? I'm also getting all my meta tag urls with trailing slash in the end. I don't want to manually write helper to remove it. Hope astro changes their API or provide some kind of config like boolean for it.

gvkhna commented 9 months ago

It looks like no updates yet.

gvkhna commented 6 months ago

It looks like this was finally checked in upstream. I think this can be closed, whatever behavior they have chosen is what we'll get and I see it has little to do with this plugin.

jonasmerlin commented 5 months ago

@gvkhna Thanks for keeping this up-to-date! Also, agreed that we'll just accept the behaviour they chose.