Repository navigation
Add version navigation to the built-in layout - #2
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Versioned documentation sites currently need a custom layout to offer a version picker. Add optional
current_versionand[[versions]]configuration so the built-in sidebar can render it.Each entry has a title and destination URL. URLs are used independently of
base_path, so a build under/docs/v2/can link to/docs/v1/or an archive on another host. The publishing workflow still builds and hosts each version separately. Sites without version configuration keep their existing navigation.The picker has a label, selects the current version, and shows a placeholder when no current version is configured. Invalid destinations, duplicate titles and an unknown current version fail before the output directory is cleaned. Custom layouts can access
.CurrentVersionand.Versions.Validation:
go test ./...passes. Built two versions locally and verified in Chromium that changing the picker navigates from v2 to v1. Added coverage for config loading, URL handling, selected and placeholder states, and unversioned sites.PR builds also skip the Pages deploy job, which otherwise fails the github-pages environment's branch protection rules.