Skip to content

Add versions dropdown

Sarah German requested to merge 27-versions-menu into main

What does this MR do and why?

Ports over the Versions dropdown to the Hugo site. This is very similar to the current implementation, but a few changes:

  • Replaces the GlDropdown component, which is now deprecated, with GlDisclosureDropdown (closes gitlab-org/gitlab-docs#1289 (closed))
  • Adds handling for URLs that will be different between Hugo and Nanoc. With Hugo, we're dropping the "ee" prefix for GitLab project docs URLs, and also using "pretty URLs," which drop the .html extension from page URLs.

This does not include a mobile version for the header navbar menu items; we'll do this in a follow-up MR.

Screenshots, screen recordings, or links to review app

Nanoc version Hugo version
image image

No major visual differences expected here.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Configure a local GitLab Docs environment: https://gitlab.com/gitlab-org/technical-writing-group/gitlab-docs-hugo/-/blob/main/doc/setup.md.
  2. From a few pages, try links on the Versions menu. They should point to the corresponding page on the production site, or the Archives site, for whichever version you've chosen.
  3. Try changing the value of HUGO_LAUNCH_VERSION in themes/gitlab-docs/src/helpers/constants.js to a version that's on the menu now (e.g, 17.1), then run a new build (CTRL+C the current preview, and make view again). Links for that version and newer will change to Hugo format (no "ee" prefix, no ".html" extensions).

Known issue: Links to pages that didn't exist in older versions (e.g, Duo docs for version 15.0, before Duo existed) will go to 404s if you try visiting that version. This behavior exists on the Nanoc site as well. No current plans to change this, although it could be improved.

Merge request acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Sarah German

Merge request reports