-
Notifications
You must be signed in to change notification settings - Fork 330
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
Add links to jump to latest version of docs #1918
base: main
Are you sure you want to change the base?
Conversation
This looks good to me but the indicator is calling too much attention. What if we keep only the warning sign? And then on mouse over it says this is not the latest version and you can click it to update? |
@josevalim I think that it would be better to have the words than the warning sign for mobile users, since there is no "mouse over" capability there. I think the colours could definitely be muted, but from an accessibility point of view, words are better. |
On mobile, we usually render the project name and version on every page, below the title, because the sidebar is not open. Shall we have the go to latest there instead (for mobile)? |
@@ -9,5 +9,9 @@ | |||
</option> | |||
{{/each}} | |||
</select> | |||
{{#if jumpToLatestUrl }} | |||
<br /> | |||
<span class="sidebar-projectVersionsLatestLink"><a href="{{jumpToLatestUrl}}">Go to latest</a></span> |
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 Rust docs say "go to latest version", not "go to latest"; I realize we have limited space because this is in the sidebar, but I wonder if it might instead be possible to say something like View latest (v{{latestVersion}})
?
Hello there, this PR slipped off my radar but I was reminded of it by this tweet: https://x.com/jskalc/status/1816920900660236370 I've pushed a change to address @halostatue's suggestion. Anything more you need from me here? Keen to get it in if possible! |
Hello! 👋
This PR addresses #1917 . It adds support for specifying which version is the latest via docs_config.js:
which will trigger a warning hyperlink to the latest version when viewing other versions:
It is not required to have a latest version in docs_config.js. Existing docs_config.js files will continue to produce the existing behaviour with no warning links.
Rather than try to determine which version is the latest through javascript logic, it seemed more appropriate to delegate to the author of docs_config.js, for example hexdocs. This avoids the risk of behaviour that differs from the documentation host's opinion on which version is the latest. This does mean that the PR doesn't do anything interesting without a small enhancement to (in practice) hexdocs.
This PR has the drawback that docs published prior to this PR will not get warnings. But due to the way exdocs works, I don't see how any attempt at fixing #1917 could get around this.