-
Notifications
You must be signed in to change notification settings - Fork 326
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
use project version (not theme version) in banner #1446
Conversation
Sorry if this is a noob question but... Is it possible to test the banner locally? Because currently the correct versions appear only when I apply the changes to the develop branch and it is compiled in ReadTheDocs (when I compile locally and in PR compilations in RTD, I only see the current version). I would prefer to try the branch locally, if possible. |
yep! You can build your site locally (using $ sphinx-build docs/ docs/_build/html/
[... lots of output ...]
$ cd docs/_build/html
$ python -m http.server
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ... |
That does not solve the problem... there is still one version to select (and thus no banner) when I build locally. |
What is the repo? (so I can clone locally and try it) |
🤦🏻 of course. Sorry. will check after lunch. |
It shouldn't matter that you're only building one version. What matters are:
in the case of That would be enough to explain why the warning banner is not showing up locally for you. If you set it to something greater than your "preferred" version (like "0.7.dev0") then it should work locally... except that your local site is trying to fetch the JSON file from remote source, so in most browsers it will be blocked by CORS policy. So to really test it locally you need to (temporarily) disable CORS in your browser. This is notoriously hard to do in Firefox (there are addons, but they often work for a while and then break with new FF releases). With chrome it should work to launch from a terminal like |
I was able to try the banner locally with the pointers you gave me. I checked that with this PR the version displayed is no longer the theme version. So far so good. However, I checked the banner by setting the |
set it manually where? In
so you changed the
What the banner says is determined by |
Yes.
I didn't. It shows up as the default selected version, but if you expand the list of versions only the ones in "versions.json" appear. Sorry for the confusion.
Ok, it was just to let you know. |
Ah ok now I understand. That should not happen. Thanks for explaining. |
I figured out why this happens. The default text for the button is here: Line 7 in eac1a87
and it gets changed only if a "match" is found between what you set in which I'm guessing doesn't exist when you build locally, so no match is found, and thus the button text is never updated. In 37eb470 I've updated it to have a saner default text for the switcher button, which will make it easier to see if the match failed (yet still make sense and yield a functioning switcher) @12rambau this one is ready for review. After this I think we should push out a bugfix release, WDYT? Any other issues you want to tackle first? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @drammock, nothing to say it works as expected and the wording works !
I tagged 3 other issues that I would like to solve before making a patch release.
If we don't solve them by Wednesday I'll release a patch anyway
PS: I opened an issue in sphinxcontrib.youtube, I'll work on it later: sphinx-contrib/youtube#63
0.14.1 fixes a broken version comparison in the javascript of the version warning banner. See pydata/pydata-sphinx-theme#1446 for more.
* Enable version warning banners for docs If the doc version isn't the preferred one, a warning banner is shown at the top. This also accounts for dev builds. * Update PyData theme to fixed 0.14.1 0.14.1 fixes a broken version comparison in the javascript of the version warning banner. See pydata/pydata-sphinx-theme#1446 for more. * Revert to proper version_switcher.json URL
fixes #1445
@vnmabus can you test against this branch?