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

Add version switcher to the site #575

Merged
merged 11 commits into from
Jun 12, 2024
Merged

Add version switcher to the site #575

merged 11 commits into from
Jun 12, 2024

Commits on May 8, 2024

  1. Configuration menu
    Copy the full SHA
    e186975 View commit details
    Browse the repository at this point in the history
  2. feat: add a build script

    This script provides a function for building a pkgdown site with
    multiple versions.
    
    Versions are defined by:
      - ref - a git ref to build. In the gist, prefix tags with `refs/tags/`
        and branches with `refs/remotes/origin/`
      - href - a URL path where the version will be available at
      - label - a label to display in a version switcher. Using true will
        take version from DESCRIPTION and append "(dev)" suffix
    
    The script works as follows:
    
    1. Copy repository into a temporary directory
    2. Read `pkgdown/navbar_template.html` and populate switcher options
       with versions
    3. For every version*:
        a. Create a git worktree based on version's ref
        b. Populate the navbar template with current version's label
        c. Write the navbar template to `pkgdown/templates/navbar.html`
           relative to the git worktree
        d. Copy `pkgdown/extra.css` from the repository we are building out
           of (this ensures a consistent and up-to-date styling)
        e. Use pkgdown to build site
        f. Remove the worktree
    
    * Version with "/" href will be built first. This avoids an error from
      pkgdown regarding building the site to a non-empty directory (that's
      not managed by pkgdown).
    
    The resulting build has the site with "/" href in the destination
    directory. Respective versions are stored in subdirectories named after
    labels defining versions.
    
    Known issues
      - Every version has its own `sitemap.xml`
      - Every version has separate assets (Bootstrap, favicons, ...)
      - All versions are indexed by search engines
      - None of the versions has canonical URLs
      - "Source" link in vignettes and function reference is hardcoded to
        HEAD (instead of a respective version)
      - Switching a version redirects to index (instead of staying on the
        same subpage in target version if it exists)
    TymekDev committed May 8, 2024
    Configuration menu
    Copy the full SHA
    5e3ef7d View commit details
    Browse the repository at this point in the history
  3. ci: use pkgdown build script

    This change pins bslib version to 0.5.1 to keep Bootstrap 5.2.2.
    Switching to a newer bslib (and Bootstrap) version requires fixing CSS.
    TymekDev committed May 8, 2024
    Configuration menu
    Copy the full SHA
    08e453d View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    d1ee335 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    6d9ac99 View commit details
    Browse the repository at this point in the history

Commits on Jun 10, 2024

  1. Configuration menu
    Copy the full SHA
    c023a42 View commit details
    Browse the repository at this point in the history

Commits on Jun 12, 2024

  1. Configuration menu
    Copy the full SHA
    76ce207 View commit details
    Browse the repository at this point in the history
  2. refactor: improve naming

    kamilzyla committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    33ca67e View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    8310d15 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8afbcba View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    fd5a656 View commit details
    Browse the repository at this point in the history