Refactor path handling for sub-directory URLs
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
- Before:
- 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 likedocs.gitlab.com
will.
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 the site in a subdirectory: make view-prod
-
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.
-
I have evaluated the MR acceptance checklist for this merge request.