harlan-zw / nuxt-seo

The complete SEO solution for Nuxt.
https://nuxtseo.com
1.03k stars 64 forks source link

I'm encountering an unexpected issue when combining Nuxt and Nuxt Schema Org. #204

Closed kng-caoxuanson closed 2 months ago

kng-caoxuanson commented 6 months ago

Details

I'm coding with the following dependencies:

"nuxt": "^3.10.2", "nuxt-schema-org": "^3.3.4"

However, when integrated, the URL automatically adds a trailing slash at the end of the page in the schema. Even though I have configured trailingSlash: false in the nuxt.config.ts file.

I'm trying to achieve the following result:

Current: https://kimkhicholon.com/danh-muc/#webpage Desired: https://kimkhicholon.com/danh-muc#webpage

Screenshot 2024-03-11 at 8 53 52 PM

I appreciate any guidance on how to achieve this. Thank you.

harlan-zw commented 6 months ago

Hmm strange, are you using base URLs by any chance :thinking: ? A reproduction would help me solve it faster for you, you can use https://stackblitz.com/edit/github-v9xq4g-nzfy4x?file=nuxt.config.ts as a starter

kng-caoxuanson commented 6 months ago

Hmm strange, are you using base URLs by any chance 🤔 ? A reproduction would help me solve it faster for you, you can use https://stackblitz.com/edit/github-v9xq4g-nzfy4x?file=nuxt.config.ts as a starter

In your example I see it still has /#website

Screenshot 2024-03-12 at 4 31 56 PM
harlan-zw commented 6 months ago

The trailing slash on the root domain is expected, either is fine but it's better practice to include it as this is how browsers will generally resolve it

Duzbee commented 5 days ago

The trailing slash triggers a "pages with redirect" in my Google Search Console for all my pages. It must be removed when trailingSlashes option is set to default. Also the schema-org:meta hook only triggers on the client side and the meta object is completly empty.

harlan-zw commented 4 days ago

The trailing slash on the root path won't trigger this. Can you please provide a reproduction if you have a separate issue?