nuxt-modules / sitemap

Powerfully flexible XML Sitemaps that integrate seamlessly, for Nuxt.
https://nuxtseo.com/sitemap
335 stars 30 forks source link

help: Why does the URL automatically end with /? I haven't set trailingSlash #349

Closed WooHoo-Wu closed 2 months ago

WooHoo-Wu commented 2 months ago

📚 What are you trying to do?

image

image

🔍 What have you tried?

No response

ℹ️ Additional context

No response

WooHoo-Wu commented 2 months ago

I use @nuxtjs/seo, the latest sitemap version

WooHoo-Wu commented 2 months ago

help me !!!

WooHoo-Wu commented 2 months ago

When I set differentDomains: true, you will add /. I can't remove it in hooks('sitemap:resolved'). I need to set differentDomains: true, and the sitemap URL does not need to be followed by /. What should I do?

WooHoo-Wu commented 2 months ago

Version v5.2.1 is OK, but nuxtjs/seo will update your version, which leads to this problem

harlan-zw commented 2 months ago

Can you make a reproduction? The only thing I can think of is that you've set the trailing slashes option somewhere.

WooHoo-Wu commented 2 months ago

reproduction: https://stackblitz.com/edit/nuxt-starter-h71ojo?file=package.json

result:

image

Please help me🥺

WooHoo-Wu commented 2 months ago

https://nuxtstarterh71ojo-geb4--3000--9569b1ab.local-credentialless.webcontainer.io/__sitemap__/hr.xml

The above link can reproduce this problem. I didn't set anything. Shouldn't it remove the trailing slash by default?

It adds it now and I can't remove it? No matter what method I use, hooks can't remove it

harlan-zw commented 2 months ago

Yes I can confirm it's a bug, I'll take a look when I have a chance.

WooHoo-Wu commented 2 months ago

Ok please asap I need it badly

WooHoo-Wu commented 2 months ago

image

I debugged it myself and found that it was the problem at this location. I hope it will be helpful.

harlan-zw commented 2 months ago

Should be fixed in 6.0.0-beta.5 :+1:

WooHoo-Wu commented 2 months ago

The @nuxtjs/seo module version is still 6.0.0-beta.2. I reinstalled @nuxtjs/sitemap and changed its version to 6.0.0-beta.5, but it still does not take effect in the production environment. What should I do?

image image

WooHoo-Wu commented 2 months ago

https://stackblitz.com/edit/nuxt-starter-h71ojo?file=package.json,nuxt.config.ts

It seems that the repair was not successful

harlan-zw commented 2 months ago

Seems fine to me, please make sure you update your lock file.

image

image

WooHoo-Wu commented 2 months ago

thanks