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

Redirected pages show up without rendering in search #2457

Open
Starlight220 opened this issue Dec 24, 2023 · 7 comments
Open

Redirected pages show up without rendering in search #2457

Starlight220 opened this issue Dec 24, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@Starlight220
Copy link
Member

Screenshot from this search query for "test mode":
image

These two results are the same page: the first result is the real page, and the second is the redirect (both lead to the real page when clicked).
There definitely shouldn't be non-rendered results. Having two identical results would be confusing, so I'd expect redirects to not show up at all in search results.

@Starlight220 Starlight220 added the bug Something isn't working label Dec 24, 2023
@sciencewhiz
Copy link
Collaborator

This happens on latest but not on stable. Probably something that happened with the Sphinx 7 update

@TheTripleV
Copy link
Member

In case it's hard to fix at build time:

// Select the first element with the class 'search'
let searchElement = document.querySelector('.search');

// Get all the child elements, which are assumed to be 'li' elements
let children = Array.from(searchElement.children);

// Loop through the children and remove the ones containing '.html'
children.forEach(child => {
  if (child.textContent.includes('.html')) {
    child.remove();
  }
});

@sciencewhiz
Copy link
Collaborator

sciencewhiz commented Dec 30, 2023

It also only appears to happen on RTD, It doesn't appear to happen on a local build (local build doesn't render any results, but also doesn't have entries for the redirected pages)

sciencewhiz added a commit to sciencewhiz/frc-docs that referenced this issue Dec 30, 2023
@sciencewhiz
Copy link
Collaborator

readthedocs can ignore files in search: https://docs.readthedocs.io/en/stable/config-file/v2.html#search-ignore #2467 is a proof of concept to show that it works.

Rediraffe could generate that list

@sciencewhiz
Copy link
Collaborator

It also doesn't happen on RTD PR builds, so it must be caused by something RTD does differently on PR builds vs regular builds

@sciencewhiz
Copy link
Collaborator

It looks like search is different intentionally with the RTD builds https://docs.readthedocs.io/en/stable/guides/pull-requests.html#limitations

@TheTripleV
Copy link
Member

https://docs.readthedocs.io/en/stable/server-side-search/index.html

Looks like they have special search infra for main builds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants