Commit c9651e2
committed
fix(layer): emit absolute sitemap URLs from configured site.url
The /sitemap.xml route resolved its base URL with `inferSiteURL()`, which
only reads environment variables (NUXT_SITE_URL, VERCEL_URL, CF_PAGES_URL,
…). A `site.url` set in nuxt.config was never consulted, so sites that
configure it the documented way fell back to `''` and emitted relative
`<loc>` values:
<loc>/docs/getting-started/introduction</loc>
The sitemap protocol requires absolute URLs, so search engines reject these.
Expose the resolved `site.url` through `runtimeConfig.public.site` (the same
pattern already used for `mcp.route`) and prefer it in the route, keeping
`inferSiteURL()` as the fallback so env-var-only deploys are unaffected.
`withoutTrailingSlash` avoids `https://example.com//docs/...` when the
configured url ends in a slash.1 parent 6f001d4 commit c9651e2
2 files changed
Lines changed: 14 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
62 | 70 | | |
63 | 71 | | |
64 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
13 | 18 | | |
14 | 19 | | |
15 | 20 | | |
| |||
0 commit comments