Describe the bug
Search engines (DuckDuckGo, Bing) index pages with a “/” at the end, which loads but is processed as 404, so even though the page is valid, it appears as “not found.”
expected behavior: i searcht resjs useTresContext (as example) select a link from results => the page opens without a 404 error.
I would add a PR, but I'm having some problems installing dependencies on bun/npm.
the easiest option is to normalize the path, for example in apps/docs/app/pages/[...slug].vue
- const { data: page } = await useAsyncData(route.path, () => queryCollection('docs').path(route.path).first())
// Remove trailing slash
+ const normalizedPath = route.path.replace(/\/$/, '') || '/'
+ const { data: page } = await useAsyncData(normalizedPath, () =>
+ queryCollection('docs').path(normalizedPath).first()
+ )
or explicitly specify the canonical url for indexing
useHead({
link: [ { rel: 'canonical', href: `${normalizedPath}` } ]
})
i think a better solution would be to add defineSitemapSchema to content.config.ts so that the content from the api is added to the sitemap.xml.
p.s. Link when create issue is not working:
Read the [Contributing Guidelines](https://github.com/Tresjs/.github/blob/main/CONTRIBUTING.md)
Read the [docs](https://tresjs.org/guide).
Reproduction
https://duckduckgo.com/?q=tersjs-tsdown-migration+site%3Atresjs.org+api+composables
Steps to reproduce
The attached link redirect to duckduckgo, with several results.
As search request i select "tresjs-tsdown-migration" because it contains in sitemap.xml and indexed correct.
- link to
https://tresjs.org › blog › tresjs-tsdown-migration working correct
- links with "api" subpath redirect to 404
System Info
System:
OS: Linux 7.0 Archcraft
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 7.73 GB / 15.42 GB
Container: Yes // no, its bare-metal
Shell: 5.9 - /usr/bin/zsh
Binaries:
Node: 20.20.2 - /usr/bin/node
npm: 11.14.1 - /usr/bin/npm
bun: 1.3.14 - /home/takimoysha/.local/share/bun/bin/bun
Deno: 2.7.14 - /usr/bin/deno
Browsers:
// i use "Vivaldi 7.9.3970.64 stable"
Brave Browser: 148.1.90.121
Firefox: 150.0.2
Firefox Developer Edition: 150.0.2
Used Package Manager
npm
Code of Conduct
Describe the bug
Search engines (DuckDuckGo, Bing) index pages with a “/” at the end, which loads but is processed as 404, so even though the page is valid, it appears as “not found.”
expected behavior: i searcht
resjs useTresContext(as example) select a link from results => the page opens without a 404 error.the easiest option is to normalize the path, for example in
apps/docs/app/pages/[...slug].vueor explicitly specify the canonical url for indexing
i think a better solution would be to add
defineSitemapSchematocontent.config.tsso that the content from the api is added to the sitemap.xml.p.s. Link when create issue is not working:
Read the [Contributing Guidelines](https://github.com/Tresjs/.github/blob/main/CONTRIBUTING.md)Read the [docs](https://tresjs.org/guide).Reproduction
https://duckduckgo.com/?q=tersjs-tsdown-migration+site%3Atresjs.org+api+composables
Steps to reproduce
The attached link redirect to duckduckgo, with several results.
As search request i select "tresjs-tsdown-migration" because it contains in sitemap.xml and indexed correct.
https://tresjs.org › blog › tresjs-tsdown-migrationworking correctSystem Info
System: OS: Linux 7.0 Archcraft CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Memory: 7.73 GB / 15.42 GB Container: Yes // no, its bare-metal Shell: 5.9 - /usr/bin/zsh Binaries: Node: 20.20.2 - /usr/bin/node npm: 11.14.1 - /usr/bin/npm bun: 1.3.14 - /home/takimoysha/.local/share/bun/bin/bun Deno: 2.7.14 - /usr/bin/deno Browsers: // i use "Vivaldi 7.9.3970.64 stable" Brave Browser: 148.1.90.121 Firefox: 150.0.2 Firefox Developer Edition: 150.0.2Used Package Manager
npm
Code of Conduct