Skip to content

Ensure correct paths for Versions menu links

Sarah German requested to merge versions-links into main

What does this MR do and why

We had to revert the addition of the new Versions menu on older online versions of the site due to incorrect menu link paths.

The bug was that the menus on older versions included the currently-viewed version in link paths, like this on the 15.1 homepage:

The correct paths do not include "15.1" (or in the case of the actual 15.1 link, we just want the one "15.1").

Changes:

  • Fixes links on the Versions menu when viewing an older version of the docs site.
  • Adds tests for menu link paths.

How to test

  1. Verify link targets are correct in the review app. Note that links to older versions won't actually resolve in the review app since we don't deploy older versions there, but you can validate the URLs against the production site.
  2. Older versions have to be tested locally. These steps assume your docs site is in ~/dev/gitlab-docs (other locations should work the same, adjust the command paths if needed):
  • Check out this branch: cd ~/dev/gitlab-docs && git fetch && git checkout versions-links
  • From the same directory as your docs site checkout, create a new instance for 15.1:
    • cd ~/dev && git clone -b 15.1 https://gitlab.com/gitlab-org/gitlab-docs.git docs-15.1
    • Set the 15.1 instance back to when it had the new menu: git checkout b63c09ea
    • Compile the 15.1 instance: cd docs-15.1 && bundle exec nanoc compile
    • Connect 15.1 to the main instance: ln -s ~/dev/docs-15.1/public/ ~/dev/gitlab-docs/public/15.1
  • Run the site: cd ~/dev/gitlab-docs && bundle exec nanoc view

If this worked right, you should be able to navigate to the 15.1 site via the Versions menu and also browse interior pages on 15.1. From there, you can verify that links on the 15.1 Versions menu are correct.

Merge request reports