-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
links on search page are broken when using dirhtml builder #4915
Comments
I'm not clear why that was seen as a solution to the CSP error with inline JS, since the search page still contains inline JS. |
My solution for now is to override the {% extends 'basic/layout.html' %}
{% block extrahead %}
<script>DOCUMENTATION_ROOT.URL_ROOT = '{{ url_root }}';</script>
{{ super() }}
{% endblock %} |
Hi, thanks for pointing out the issue. You are correct on two fronts: the non-HTML template expands config variables (but not the built-in functions) and it seems to only get expanded once anyway, so it's not a solution. As for the search page containing inline JS, that needs to be fixed and thanks for catching that. Here's a quick fix:
Let me know if that works for you before I submit a PR. |
Fixed by #4916. |
#4295 moved the documentation options into a separate JS file. This breaks the search page when using the
dirhtml
builder because links no longer point to the parent directory, they point below the/search/
page.Previously, the JS was generated on each page, so
pathto('', 1)
generated../
for the search page. However, now that the file is separate which doesn't extendlayout.html
(since it's not an HTML template),url_root
is undefined and the code always generates''
.sphinx/sphinx/themes/basic/static/documentation_options.js_t
Line 2 in feee462
Before the change, a link from the search page would look like
../api/
, so the URL ended up being/api/
. Now, it looks likeapi/
, so the URL is/search/api/
.See pallets/flask#2743 for an example of this issue.
The text was updated successfully, but these errors were encountered: