Improve path handling for navigation
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.
-
Configure a local GitLab Docs environment: https://gitlab.com/gitlab-org/technical-writing-group/gitlab-docs-hugo/-/blob/main/doc/setup.md. -
Run make view
and verify the site and navigation works at on the bare domain: http://localhost:1313 -
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.
-
I have evaluated the MR acceptance checklist for this merge request.
Edited by Sarah German