Skip to content
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

Incorrect URL's when using a subdirectory structure #13

Closed
5 tasks done
hbanham opened this issue Feb 28, 2023 · 4 comments
Closed
5 tasks done

Incorrect URL's when using a subdirectory structure #13

hbanham opened this issue Feb 28, 2023 · 4 comments

Comments

@hbanham
Copy link

hbanham commented Feb 28, 2023

Describe the bug

For websites that are hosted in a subdirectory, for example https://example.com/subdirectory/{files}
I configure Nuxt's baseURL and Nitro's publicDir to output the site files in the subdirectory required.

The sitemap.xml that is generated includes URL's without the subdirectory:
image

The last two URL's in my screenshot which include the subdirectory path are created by adding <NuxtLink>'s that point to the pages.
I think the first two URL's must be generated based on the page directory or something similar, which don't account for the subdirectory.

In the reproduction:

  1. npm run generate
  2. code .output/public/subdirectory/sitemap.xml to view the sitemap file.

Reproduction

https://stackblitz.com/edit/nuxt-starter-r74ewa

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz    
    Memory: 2.01 GB / 15.85 GB
  Binaries:
    Node: 18.12.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.17.3 - C:\Program Files (x86)\Yarn\bin\yarn.CMD  
    npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 110.0.5481.177
    Edge: Spartan (44.19041.1266.0), Chromium (110.0.1587.57)
    Internet Explorer: 11.0.19041.1566

Used Package Manager

npm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.
@harlan-zw
Copy link
Collaborator

Hey @hbanham

Thanks for the detailed issue! I've pushed up v1.0.8 that should fix this

@hbanham
Copy link
Author

hbanham commented Mar 7, 2023

Hey, thank you for the quick response!

I'm sorry to say but the update hasn't fixed the generated output file for me, though the preview now looks correct:
image

I've created a new StackBlitz reproduction, same as before but with version 1.0.8:
https://stackblitz.com/edit/nuxt-starter-zdfvhp

@harlan-zw harlan-zw reopened this Mar 7, 2023
@harlan-zw
Copy link
Collaborator

Oops, you are right!

I've pushed up a v1.0.9 fix, it also fixes an issue with nitro route rule matching.

Updated stackblitz: https://stackblitz.com/edit/nuxt-starter-w8kega?file=nuxt.config.ts

Sorry for the back and forth, hopefully it's all good now, let me know if not :)

@hbanham
Copy link
Author

hbanham commented Mar 7, 2023

No worries at all, I really appreciate the fast response.
Thank you for looking into this, it's working beautifully!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants