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

Update version switcher to set 2.0 as preferred version #25

Merged
merged 3 commits into from
Jun 17, 2024

Conversation

melissawm
Copy link
Member

Also adds a 'preferred' keyword to the stable version, which is used to select which pages receive a version warning banner from the PyData Sphinx Theme.

This should be merged after the 2.0 documentation is published, so that "stable" points to the right pages.

Also adds a 'preferred' keyword to the stable version, which is used to select which pages receive a version warning banner from the PyData Sphinx Theme.
melissawm added a commit to melissawm/numpy that referenced this pull request Jun 17, 2024
…Theme

After numpy/doc#25, this will show a warning banner for past and unreleased versions of the docs.

See https://pydata-sphinx-theme.readthedocs.io/en/latest/user_guide/announcements.html#version-warning-banners

The warning banner can be dismissed by the user.
@melissawm
Copy link
Member Author

@charris can you merge this one?

@seberg
Copy link
Member

seberg commented Jun 17, 2024

Well, I didn't expect a silly whitespace fix to cause merge conflicts!? Will look into it, or do you just want to force push @melissawm and then we put it in without things?

@melissawm
Copy link
Member Author

I'll update 👍

@seberg seberg changed the title Update version switcher to set 2.0 as stable version Update version switcher to set 2.0 as preferred version Jun 17, 2024
@melissawm
Copy link
Member Author

Should be good to go - thanks @seberg

@seberg seberg merged commit 7d9a948 into numpy:main Jun 17, 2024
@seberg
Copy link
Member

seberg commented Jun 17, 2024

Thanks! I guess it might now only be the preferred thing anymore, but that is good anyway.

Is it correct that it shows "Choose version" for the stable one?

@melissawm
Copy link
Member Author

Hmm this may be pydata/pydata-sphinx-theme#1829? Let me check

@melissawm
Copy link
Member Author

Looking at the console for the stable docs I see

Uncaught ReferenceError: $ is not defined
    <anonymous> https://numpy.org/doc/_static/versionwarning.js:13

Not sure if this is interfering with the PyData version switcher. I'll try to debug

@mattip
Copy link
Member

mattip commented Jun 17, 2024

stackoverflow says the script is missing a jquery reference, something like

<script language="JavaScript" type="text/javascript" src="/js/jquery-1.2.6.min.js"></script>

And indeed, when I compare the 2.0 directory to the other versions, I see it is missing a _static/jquery.js

@melissawm
Copy link
Member Author

Not sure if that fixes the switcher but let's try

@mattip
Copy link
Member

mattip commented Jun 17, 2024

Something else is wrong, I don't see a call to load the script from the HTML. I will try rebuilding the docs.

@melissawm
Copy link
Member Author

Let me know if you need help, I'll be around.

@mattip
Copy link
Member

mattip commented Jun 17, 2024

Something changed with the format of the version string in versions.json, so they no longer match. The generated HTML all needs to be changed

     <script>
         DOCUMENTATION_OPTIONS.theme_version = '0.15.3';
         DOCUMENTATION_OPTIONS.theme_switcher_json_url = 'https://numpy.org/doc/_static/versions.json';
+        DOCUMENTATION_OPTIONS.theme_switcher_version_match = 'doc/2.0';
-        DOCUMENTATION_OPTIONS.theme_switcher_version_match = '2.0';
         DOCUMENTATION_OPTIONS.show_version_warning_banner = false;
         </script>

or the versions.json needs to be changed

     {
         "name": "2.0 (stable)",
-        "version": "doc/2.0",
+        "version": "2.0",
         "url": "https://numpy.org/doc/stable/",
         "preferred": true
     },

@melissawm
Copy link
Member Author

Are you rebuilding @mattip or would you like me to do it?

ArvidJB pushed a commit to ArvidJB/numpy that referenced this pull request Nov 1, 2024
…Theme

After numpy/doc#25, this will show a warning banner for past and unreleased versions of the docs.

See https://pydata-sphinx-theme.readthedocs.io/en/latest/user_guide/announcements.html#version-warning-banners

The warning banner can be dismissed by the user.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants