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

Documentation 404 pages are broken #678

Closed
gotmax23 opened this issue Oct 20, 2023 · 14 comments · Fixed by #851
Closed

Documentation 404 pages are broken #678

gotmax23 opened this issue Oct 20, 2023 · 14 comments · Fixed by #851
Labels
bug Something isn't working doc builds Relates to building the documentation

Comments

@gotmax23
Copy link
Collaborator

404 pages are currently quite broken. Navigate to any arbitrary URL (e.g., https://docs.ansible.com/ansible/latest/xxjxjx), and you'll get an unformatted HTML page with random text. There used to be a proper 404 page with a cowsay image, but it seems that broke some time ago.

@gotmax23 gotmax23 added bug Something isn't working doc builds Relates to building the documentation labels Oct 20, 2023
@ansible-documentation-bot ansible-documentation-bot bot added the needs_triage Needs a first human triage before being processed. label Oct 20, 2023
@gotmax23
Copy link
Collaborator Author

gotmax23 commented Oct 20, 2023

9d4c6db fixes part of the problem, but there's still broken stylesheet links in the header:

<!-- _build/html/404.html from make coredocs -->
      <link rel="stylesheet" href="/ansible/latest/_CascadingStyleSheet('_static/pygments.css', priority=200, rel='stylesheet', type='text/css')" type="text/css" />
      <link rel="stylesheet" href="/ansible/latest/_CascadingStyleSheet('_static/css/ansible.css', priority=200, rel='stylesheet', type='text/css')" type="text/css" />
      <link rel="stylesheet" href="/ansible/latest/_CascadingStyleSheet('_static/antsibull-minimal.css', priority=500, rel='stylesheet', type='text/css')" type="text/css" />
      <link rel="stylesheet" href="/ansible/latest/_CascadingStyleSheet('_static/css/rtd-ethical-ads.css', priority=500, rel='stylesheet', type='text/css')" type="text/css" />
      <link rel="stylesheet" href="/ansible/latest/_CascadingStyleSheet('_static/css/core-color-scheme.css', priority=800, rel='stylesheet', type='text/css')" type="text/css" />

vs. the following in a correctly formatted page:

<!-- _build/html/index.html from make coredocs -->
      <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
      <link rel="stylesheet" href="_static/css/ansible.css" type="text/css" />
      <link rel="stylesheet" href="_static/antsibull-minimal.css" type="text/css" />
      <link rel="stylesheet" href="_static/css/rtd-ethical-ads.css" type="text/css" />
      <link rel="stylesheet" href="_static/css/core-color-scheme.css" type="text/css" />

@gotmax23 gotmax23 moved this from 🆕 Triage to 📋 Backlog in Ansible Documentation Oct 24, 2023
@samccann samccann removed the needs_triage Needs a first human triage before being processed. label Oct 26, 2023
@samccann samccann moved this from 📋 Backlog to 🏗 In progress in Ansible Documentation Oct 26, 2023
@gotmax23
Copy link
Collaborator Author

@felixfontein, @webknjaz, any idea what's going on here? You know more about the Sphinx stuff than I do.

@webknjaz
Copy link
Member

Well, Sphinx is a static site generator. If you end up on a URL that doesn't have a stub page, whatever webserver you use will use its own 404. Though, relative links are hard regardless, in this case.

@webknjaz
Copy link
Member

Is your problem that _CascadingStyleSheet gets rendered as text?

@felixfontein
Copy link
Collaborator

A similar issue was reported here recently: readthedocs/sphinx-notfound-page#224

I also had this problem (_CascadingStyleSheet showing up in the HTML file) a bit earlier today, but then I wasn't able to reproduce it.

Do you have a way to reproduce this @gotmax23?

@felixfontein
Copy link
Collaborator

(And yes, 9d4c6db is definitely needed. Can you create a PR for it?)

@gotmax23
Copy link
Collaborator Author

Well, Sphinx is a static site generator. If you end up on a URL that doesn't have a stub page, whatever webserver you use will use its own 404.

Right, but we use sphinx-notfound-page to generate a 404 page that's served by the webserver when a path is not found.

Is your problem that _CascadingStyleSheet gets rendered as text?

Yes.

Do you have a way to reproduce this @gotmax23?

Running make coredocs and looking at the generated 404.html should be enough to reproduce it.

@gotmax23
Copy link
Collaborator Author

(And yes, 9d4c6db is definitely needed. Can you create a PR for it?)

I opened #827 as a draft.

@felixfontein
Copy link
Collaborator

Do you have a way to reproduce this @gotmax23?

Running make coredocs and looking at the generated 404.html should be enough to reproduce it.

After running it the first time I also got the bad links. After running make clean, manually purging the Sphinx build data, and running make coredocs again I got working links. So right now I cannot reproduce this, at least not on my system.

@gotmax23
Copy link
Collaborator Author

Are you using the pinned dependencies? The RTD builds have the same issue, and they run in a clean environment.

$ curl -s https://ansible--827.org.readthedocs.build/projects/ansible-core/en/827/404.html | grep -n _CascadingStyleSheet
8:      <link rel="stylesheet" href="/ansible/latest/_CascadingStyleSheet('_static/pygments.css', priority=200, rel='stylesheet', type='text/css')" type="text/css" />
9:      <link rel="stylesheet" href="/ansible/latest/_CascadingStyleSheet('_static/css/ansible.css', priority=200, rel='stylesheet', type='text/css')" type="text/css" />
10:      <link rel="stylesheet" href="/ansible/latest/_CascadingStyleSheet('_static/antsibull-minimal.css', priority=500, rel='stylesheet', type='text/css')" type="text/css" />
11:      <link rel="stylesheet" href="/ansible/latest/_CascadingStyleSheet('_static/copybutton.css', priority=500, rel='stylesheet', type='text/css')" type="text/css" />
12:      <link rel="stylesheet" href="/ansible/latest/_CascadingStyleSheet('_static/css/rtd-ethical-ads.css', priority=500, rel='stylesheet', type='text/css')" type="text/css" />
13:      <link rel="stylesheet" href="/ansible/latest/_CascadingStyleSheet('_static/css/core-color-scheme.css', priority=800, rel='stylesheet', type='text/css')" type="text/css" />

@felixfontein
Copy link
Collaborator

No, I used the dev versions of the packages I had installed locally.

I did some more digging. Upgrading sphinx_rtd_theme from 1.3.0 to 2.0.0rc2 helped. (2.0.0rc1 has the same problem.) When looking at the differences between 2.0.0rc1 and 2.0.0rc2 my spontaneous guess is that readthedocs/sphinx_rtd_theme#1519 fixes the problem.

So we can probably:

  1. Either upgrade to a pre-release of sphinx_rtd_theme;
  2. Or downgrade Sphinx to < 7.2;
  3. Or wait for 2.0.0 of sphinx_rtd_theme (and keep the 404 page broken until then).

@samccann
Copy link
Contributor

#3 doesn't seem a viable option since rc2 was back at the end of Aug (aka we have no real idea when the official 2.0 version will be released.

#2 seems to be the safe solution - going back to a stable set of requirements.

I could live with #1 if folks prefer that approach.

@gotmax23
Copy link
Collaborator Author

What about trying #1 on devel and #2 on stable-2.16 and stable-2.15?

gotmax23 added a commit to gotmax23/ansible-documentation that referenced this issue Nov 21, 2023
gotmax23 added a commit to gotmax23/ansible-documentation that referenced this issue Nov 21, 2023
@gotmax23
Copy link
Collaborator Author

What about trying #1 on devel and #2 on stable-2.16 and stable-2.15?

devel: #851
stable-2.16: #852

@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in Ansible Documentation Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working doc builds Relates to building the documentation
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants