Skip to content

Refactor path handling for sub-directory URLs

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

What does this MR do and why?

  • Fixes an edge case with versions URLs from the homepage when running in a sub-directory (in this example, the subdir is technical-writing-group/gitlab-docs-hugo)
    • Before: https://docs.gitlab.com/16.10/technical-writing-group/gitlab-docs-hugo/
    • After: https://docs.gitlab.com/16.10
  • Removes an unneeded path function from the sidebar navigation
  • Improves test coverage for menu links
  • Adds our "production domain" for this dev project to the isProduction() check. We want this site to render like docs.gitlab.com will.

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. Run the site in a subdirectory: make view-prod
  3. Verify links on the versions menu are correct on both the homepage and an interior page

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.

Merge request reports