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

Some pages are displayed twice in search results (with and without .html) #15342

Closed
1 of 4 tasks
HugoImaios opened this issue Dec 13, 2023 · 7 comments · Fixed by #15984
Closed
1 of 4 tasks

Some pages are displayed twice in search results (with and without .html) #15342

HugoImaios opened this issue Dec 13, 2023 · 7 comments · Fixed by #15984
Labels
documentation Improvements or additions to documentation

Comments

@HugoImaios
Copy link

HugoImaios commented Dec 13, 2023

Documentation is

  • Missing
  • Outdated
  • Confusing
  • Not sure?

Explain in Detail

For some reason (seo?) that is not questioned here, documentation pages are indexed both as /path and /path.html
It's quite transparent when navigating, but when searching, it causes some results to appear twice.
For example, when searching the string "Babel", we get in the "Guide & APIs" section of the results, these 4 results :
a) https://vitejs.dev/guide/performance.html#use-lesser-or-native-tooling
b) https://vitejs.dev/guide/performance#use-lesser-or-native-tooling
c) https://vitejs.dev/guide/philosophy.html#a-pragmatic-approach-to-performance
d) https://vitejs.dev/guide/philosophy#a-pragmatic-approach-to-performance

and as you can see, except the ".html" part of the url a) duplicates b), and so does c) with d)

Your Suggestion for Changes

before any "unique" operation is applied, strip out the .html artificial extension when processing search result
(because I guess adding those artificial ".html" was for a good reason)

Reproduction

https://vitejs.dev/guide/

Steps to reproduce

  • press Ctrl + K
  • type "Babel"
  • scroll to "Guide & APIs" results section
  • see duplicated items (preview are the same and their page have the same content)
@HugoImaios HugoImaios added the documentation Improvements or additions to documentation label Dec 13, 2023
@HugoImaios HugoImaios changed the title Some pages twice in search results (with and without .html) Some pages are displayed twice in search results (with and without .html) Dec 13, 2023
@Soumik29
Copy link

Can you provide the source code of where the error is occurring so I can see if I can fix it.

@HugoImaios
Copy link
Author

It's not linked to any particular code from vite library, it's an issue concerning its documentation website

@bluwy
Copy link
Member

bluwy commented Dec 22, 2023

The Vite site does enable Netlify's Pretty URL feature, but it seems like it doesn't redirect to the prettier URL, it only enables "understanding" how to fallback for pretty URLs. I'm not sure if there's anything we can do without changing the hosting platform, unless we manually configure redirects.

@HugoImaios
Copy link
Author

The Vite site does enable Netlify's Pretty URL feature, but it seems like it doesn't redirect to the prettier URL, it only enables "understanding" how to fallback for pretty URLs. I'm not sure if there's anything we can do without changing the hosting platform, unless we manually configure redirects.

Oh ok!
For what I see and understand, redirects are OK. At least, both URLs work. The problem might come from Algolia which should not list both URLs

@sapphi-red
Copy link
Member

Adding <link rel="canonical" href="url without extension" /> to each page might work. Algolia seems to support this.
https://www.algolia.com/doc/guides/building-search-ui/resources/seo/js/#you-use-canonical-urls-to-indicate-primary-content

@HugoImaios
Copy link
Author

HugoImaios commented Jan 2, 2024

Adding <link rel="canonical" href="url without extension" /> to each page might work. Algolia seems to support this. https://www.algolia.com/doc/guides/building-search-ui/resources/seo/js/#you-use-canonical-urls-to-indicate-primary-content

would you like me to open a PR with that or are you still gathering information ?

@sapphi-red
Copy link
Member

@HugoImaios I would appreciate it if you could open a pull request. 👍

@github-actions github-actions bot locked and limited conversation to collaborators Mar 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants