quarto-version-selector
A version selector dropdown for Quarto websites. The selector appears in the navbar once the site is deployed with quarto-version-selector deploy, which writes a versions.json file to the root of the docs branch.
Inspired by the mike plugin for mkdocs.
Getting started
Install the extension
quarto add CCBR/quarto-version-selectorEnable the filter in _quarto.yml:
filters:
- version-selectorChoose a placement
version-selector:
placement: navbar-left # navbar-left | navbar-right | fixed-left | fixed-right | sidebar | nonenavbar-left(default): the start of the left navbar menu. Falls back to the right-hand navbar tools, or the top-left of the page if there is no navbar.navbar-right: the start of the right-hand navbar tools (next to the GitHub icon, search, and dark-mode toggle). Falls back to the top-right of the page if there is no navbar.fixed-left/fixed-right: pinned to the top-left or top-right corner of the page.sidebar: the top of the docked sidebar. Falls back tonavbar-leftif the page has no sidebar.none: only shown in an element you place yourself:::: {#version-selector} :::
Deploy with GitHub Actions
.github/workflows/docs-quarto.yml
name: quarto-publish-versioned
on:
workflow_dispatch:
release:
types: [published]
push:
branches: [main]
concurrency:
group: docs-deploy
cancel-in-progress: false
permissions:
contents: write
pages: write
jobs:
deploy-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: quarto-dev/quarto-actions/setup@v2
- uses: CCBR/quarto-version-selector/.github/actions/deploy-version@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}Then configure GitHub Pages to publish from the gh-pages branch.