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

Create a select box to switch between releases/branches like the old docs #1087

Open
mrpollo opened this issue Mar 3, 2021 · 0 comments
Open
Assignees

Comments

@mrpollo
Copy link
Contributor

mrpollo commented Mar 3, 2021

There used to be a very nifty feature in the old documentation, on the sidebar we had a select box populated with the latest releases, and it would let you jump between them.

  • Fetch JSON dynamically from GitHub that had a list of version text and versions. This then applies to ALL versions of the docs, even ones that have already been published.
  • When the menu is "closed" it displays the currently selected version - ie on v1.11 the text displayed in the box would be v1.11.
  • Changing to new version changes to the same page in the new version

It looks like this on v1.10 branch (Try it here):

image

  • For gitbook the version was fetched from master branch book.json, which looks like this. NOte the gitbookConfigURL URL is used if defined - this points to the "actual" version of the file that should be used, if it exists. On master it uses the other options.
        "versions": {
            "gitbookConfigURL": "https://raw.githubusercontent.com/PX4/px4_user_guide/master/book.json",
            "options": [
                {
                    "value": "https://docs.px4.io/master/en/",
                    "text": "master"
                },
                {
                    "value": "https://docs.px4.io/v1.11/en/",
                    "text": "v1.11 - stable"
                },
                {
                    "value": "https://docs.px4.io/v1.10/en/",
                    "text": "v1.10"
                },
                {
                    "value": "https://docs.px4.io/v1.9.0/en/",
                    "text": "v1.9"
                },
                {
                    "value": "https://docs.px4.io/v1.8.2/en/",
                    "text": "v1.8"
                }
            ]
        }
    
@mrpollo mrpollo self-assigned this Mar 3, 2021
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

No branches or pull requests

1 participant