-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Broken links in version picker menu for HtmlDir index pages #5254
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
Comments
A source of the problem seems to be this code in footer_views: if page_slug and page_slug != 'index':
if (
main_project.documentation_type == 'sphinx_htmldir' or
main_project.documentation_type == 'mkdocs'
):
path = page_slug + '/'
# ... page_slug on a sphinx_htmldir subdir index page is "subdir/index" (e.g., "sending/index" in the reported example). I can't find the code that generates page slugs, which is probably the right place to fix this. (That slug should probably be just "sending".) But an easy workaround here would be |
Thanks! If this was working before, I can think of an incompatible change in sphinx, if this wasn't working before, then I think it's a bug. And we want to remove this magic of the documentation type #4638 |
So, yeah, this is definitely a bug, the page slug for nested dirs is |
It's very possible I'm remembering wrong that it worked before. If RTD's |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Still valid |
@stsewd happy to submit a PR if that would help. I think the fix is in footer_views.py: if page_slug and page_slug != 'index':
if main_project.documentation_type == 'sphinx_htmldir':
+ if page_slug.endswith('/index'):
+ path = page_slug[:-5]
+ else:
path = page_slug + '/'
else:
path = page_slug + '.html'
else:
path = '' If so, I could use some guidance on where to add a test or pointers to similar tests. (test_footer.py? There don't seem to be many tests specific to sphinx_htmldir.) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Details
In Sphinx-HtmlDir docs, the version picker menu has broken links on any page that is generated from a subdir/index.rst. The URLs for such pages look like
.../subdir/
, but the version picker menu incorrectly links to.../subdir/index/
, which is a 404.(Fairly certain this used to work correctly.)
Expected Result
To reproduce:
Expected Result: The link should be to https://anymail.readthedocs.io/en/latest/sending/ (without the "index" at the end).
Actual Result
Actual Result: The menu links to https://anymail.readthedocs.io/en/latest/sending/index/ (SORRY: This page does not exist yet.)
Note that on non-index pages, the version menu works correctly (e.g., https://anymail.readthedocs.io/en/stable/sending/django_email/, built from docs/sending/django_email.rst)
The text was updated successfully, but these errors were encountered: