Instant navigation breaks third-party URLs
See original GitHub issue- I’ve read the [contribution guidelines][1] and agree with them
I’ve found a bug and checked that …
- … the problem doesn’t occur with the default MkDocs template
- … the problem is not in any of my customizations (CSS, JS, template)
- … the documentation does not mention anything about my problem
- … there are no open or closed issues that are related to my problem
Description
Enabling navigation.instant
modified Isso requests URLs on first load. A page reload restores them.
Expected behavior
Requests are sent to usual URLs
Actual behavior
Requests are sent to a non existent URL
Steps to reproduce the bug
My website has https://example.org/mkdocs/ set as site_url and loads on every page the following Isso code:
{% block disqus %}
{% if not page.is_homepage %}
<script data-isso="https://example.org/comments" src="https://example.org/comments/js/embed.dev.js"></script>
<section id="isso-thread"></section>
{% endif %}
{% endblock %}
The file embed.dev.js
is the minified version of this attached file: embed.dev.js.txt. It generates URLs from the “data-isso” attribute.
Without navigation.instant
, comments are properly loaded:
- First load
Code | Method | URL |
---|---|---|
200 | GET | https://example.org/mkdocs/PAGE |
200 | GET | https://example.org/comments/js/embed.dev.js |
200 | POST | https://example.org/comments/count |
200 | GET | https://example.org/comments/?uri=PAGE&nested_limit=5 |
- Page Reload
Code | Method | URL |
---|---|---|
200 | GET | https://example.org/mkdocs/PAGE |
200 | GET | https://example.org/comments/js/embed.dev.js |
200 | POST | https://example.org/comments/count |
200 | GET | https://example.org/comments/?uri=PAGE&nested_limit=5 |
I noticed that by enabling navigation.instant
the request URLs appear modified (XHR interceptor?), but only at the first load of the page.
A user has has in fact to press F5 everytime he changes page, otherwise he will see the comment section, but he won’t be able to create or load comments.
- First load
Code | Method | URL |
---|---|---|
200 | GET | https://example.org/mkdocs/PAGE |
200 | GET | https://example.org/comments/js/embed.dev.js |
404 | POST | https://example.org/assets/javascripts/bundle/count |
404 | GET | https://example.org/assets/javascripts/bundle/?uri=PAGE&nested_limit=5 |
- Page reload
Code | Method | URL |
---|---|---|
200 | GET | https://example.org/mkdocs/PAGE |
200 | GET | https://example.org/comments/js/embed.dev.js |
200 | POST | https://example.org/comments/count |
200 | GET | https://example.org/comments/?uri=PAGE&nested_limit=5 |
I have tried with clean MkDocs directories multiple times and the problem always (and only) appears when enabling instant navigation.
Package versions
- Python:
3.9
- MkDocs:
1.1.2
- Material:
7.0.0
System information
- OS: any
- Browser: any
Issue Analytics
- State:
- Created 3 years ago
- Comments:20 (15 by maintainers)
Top GitHub Comments
b6779114 now preserves all attributes of the
script
tag. This might fix the issue.Here’s the same zip I mailed you, also in case @polarathene would like to give it a try: material-isso.zip
Please go back and forth between “home” and “test”, so you can see the actual behaviour. By reloading a page you will see that the error is gone. The file javascript file of the “src” attribute is always loaded properly, the URLs that are modified are the ones generated by that file.
First load:
Page reload: