-
Notifications
You must be signed in to change notification settings - Fork 229
Enable switching different versions of documentation #621
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
Conversation
How to test this PR: ``` git checkout doc-switcher cd doc make cd .. git checkout gh-pages rm -r dev cp -r doc/_build/html dev python -m http.server ```
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.
Awesome comprehensive writeup! Managed to go through the step by step instructions and got this working locally in no time. Only two minor nitpick comments (which you can ignore), otherwise let's get this handy feature merged in (after changing "0.0.0.0:8000" to "www.pygmt.org" of course)!
|
||
<!-- Documentation switcher --> | ||
<!-- Point to the *dev* version switcher. This will allow the latest versions to appear on older documentation. --> | ||
<script type="text/javascript" src="/dev/_static/version_switch.js"></script> |
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.
I'm not a frontend/javascript expert, and I don't expect you to work on this. But, just pointing out that the dropdown isn't super-accessible. I managed to tab-tab-tab my way to the version changer dropdown (with the benefit of sight), and change to a different version of the documentation by pressing up/down with my arrow keys (only once though, it doesn't seem to allow scrolling through the list of options).
Guess my point here is that we should keep the section at https://www.pygmt.org/v0.2.0/index.html#documentation-for-other-versions for now just for a11y reasons, until we get a good developer that knows this stuff.
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.
Let's open an issue and see if someone with good web knowledge can help us.
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.
The changes are online now, and you can try it at https://www.pygmt.org.
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.
Yay 🎉! I see you've made the change directly at ae2aee5. Good work 👍
Description of proposed changes
Enable switching different versions of documentation. Adapted from GenericMappingTools/gmt#4110.
Preview:
How to preview/test this PR locally:
You will see that you can switch from
dev
to other versions, but can't swich back. That's because the old documentations are static HTML files, and don't include theversion_switch.js
script.To enable switching back and forth, we need to manually add the following line in the HTML head part.
This can be done by running the following command in each subdirectory (e.g., in
v0.2.0
)note: the sed command only work for the GNU
sed
. For macOS users, rungsed
instead.TODO before merging this PR
doc_url
from0.0.0.0:8000
(for local testing) towww.pygmt.org
TODO after merging this PR
_static/documentation_options.js
file. It contains basic settings of the documentation. For old documentations, theVERSION
setting is empty, because we didn't set therelease
variable inconf.py
. It will shows the weirdlatest ()
instead oflatest (v0.2.0)
. We need to manually update the files of all old versions.Fixes #609.
Reminders
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
.