Skip to content

Improve path handling for navigation

Sarah German requested to merge 8-nav-links-prefix into main

What does this MR do and why?

Ensures navigation links work when the site is deployed in a subdirectory (like docs.gitlab.com/15.0, or in the short term, https://gitlab-org.gitlab.io/technical-writing-group/gitlab-docs-hugo/).

  • Adds a metatag to store the base URL (generated by Hugo), and uses this to make navigation links absolute
  • Adjusts Vite configuration to use dynamic base path
  • Adds shortcut for running a subdirectory-style site locally (make view-prod)

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 make view and verify the site and navigation works at on the bare domain: http://localhost:1313
  3. Run make view-prod and verify the site and navigation works in a subdirectory: http://localhost:1313/technical-writing-group/gitlab-docs-hugo/

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