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

Add the Sphinx notfound page extension #15669

Open
wants to merge 3 commits into
base: devel
Choose a base branch
from

Conversation

oraNod
Copy link
Collaborator

@oraNod oraNod commented Nov 26, 2024

SUMMARY

Add https://sphinx-notfound-page.readthedocs.io/en/latest/installation.html

This is an attempt to fix the 404 page issues on read the docs.

ISSUE TYPE
  • Bug, Docs Fix or other nominal change
COMPONENT NAME
  • Docs
AWX VERSION

n/a

ADDITIONAL INFORMATION

follows up on #15668

Copy link

sonarcloud bot commented Nov 26, 2024

@oraNod
Copy link
Collaborator Author

oraNod commented Nov 26, 2024

I've added this to a project from my fork: https://oranod-awx.readthedocs.io/en/latest/

You can request a fake page name like foo.html and see the 404 page is there. The cowsay image is apparently getting picked up by the extension but the theme isn't applied.

Copy link
Member

@webknjaz webknjaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comparing https://oranod-awx.readthedocs.io/en/latest/ and https://oranod-awx.readthedocs.io/en/latest/foo.html:

- <title>Ansible AWX Documentation &mdash; Ansible AWX community documentation</title>
+ <title>Oh no! &mdash; Ansible AWX community documentation</title>
-       <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+       <link rel="stylesheet" href="/en/latest/_CascadingStyleSheet('_static/pygments.css', priority=200, rel='stylesheet', type='text/css')" type="text/css" />
-       <link rel="stylesheet" href="_static/css/ansible.css" type="text/css" />
+       <link rel="stylesheet" href="/en/latest/_CascadingStyleSheet('_static/css/ansible.css', priority=200, rel='stylesheet', type='text/css')" type="text/css" />
-       <link rel="stylesheet" href="_static/css/rtd-ethical-ads.css" type="text/css" />
+       <link rel="stylesheet" href="/en/latest/_CascadingStyleSheet('_static/css/rtd-ethical-ads.css', priority=500, rel='stylesheet', type='text/css')" type="text/css" />
-     <link rel="shortcut icon" href="_static/images/Ansible-Mark-RGB_Black.png"/>
+     <link rel="shortcut icon" href="/en/latest/_static/images/Ansible-Mark-RGB_Black.png"/>
    <!--[if lt IE 9]>
-     <script src="_static/js/html5shiv.min.js"></script>
+     <script src="/en/latest/_static/js/html5shiv.min.js"></script>
    <![endif]-->
  
-         <script src="_static/jquery.js?v=5d32c60e"></script>
+         <script src="/en/latest/_static/jquery.js?v=5d32c60e"></script>
-         <script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
+         <script src="/en/latest/_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
-         <script src="_static/documentation_options.js?v=a9b6e813"></script>
+         <script src="/en/latest/_static/documentation_options.js?v=a9b6e813"></script>
-         <script src="_static/doctools.js?v=888ff710"></script>
+         <script src="/en/latest/_static/doctools.js?v=888ff710"></script>
-         <script src="_static/sphinx_highlight.js?v=dc90522c"></script>
+         <script src="/en/latest/_static/sphinx_highlight.js?v=dc90522c"></script>
-     <script src="_static/js/theme.js"></script>
+     <script src="/en/latest/_static/js/theme.js"></script>

I'm not sure why _CascadingStyleSheet() is leaking into the rendered HTML output. I think I saw this before, but never looked deep. The theme demo seems to be fine: https://sphinx-ansible-theme.readthedocs.io/en/latest/foo.html.

I think there's some incompatibility between versions of CPython, Sphinx and the underlying sphinx-rtd-theme. Somebody will probably have to bisect it.

readthedocs/sphinx-notfound-page#224 mentions the same problem and ansible/ansible-documentation#678 links ansible/ansible-documentation@9d4c6db that suggests that changing what settings are used might be the fix: https://github.com/ansible/ansible-documentation/pull/827/files#diff-de16707d76a94c258b2d4ba2b8f95910db018b923e2b4834dacf47c8964b2a90R340.

@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# This file is autogenerated by pip-compile with Python 3.12
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oraNod you must always use the same environment to update constraints files. The AWX folks do this in their container for consistency. Plus, the updater script won't generate path changes back and forth in the comment lines below.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants