Add config to build a local archive version
What does this MR do and why?
- Adds a new make target for running an archived version of the site (
make view-archive)- Adds new
yarnscripts for creating a Vite build with a versioned URL - Adjusts Pagefind config to use the versioned URL
- Adds new
- Copies over version-related documentation (original version)
- Adjusts template logic to work with archive version paths. Our checks for specific page paths need to be version-agnostic.
- Adds logic to the Survey banner component so that it only appears if we're on the pre-release version of the site (site built from the
mainbranch, not an archive)
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. -
Start with a clean env: make clean -
Test the make target without an env var: make view-archive- Expected behavior: error message reminding you to set
CI_COMMIT_REF_NAME
- Expected behavior: error message reminding you to set
-
Run the site with archive-style paths: CI_COMMIT_REF_NAME=15.2 make view-archive
Verify that version-related features work as expected:
- Search uses pagefind (and returns results as expected)
- Versions menu in the top-right shows the proper version number
- If you enable the banner (update
data/banner.yamland set "enabled" totrue), it should not appear (we never want to show this on archived versions)
Verify that path-related logic still works as expected:
- http://localhost:1313/15.2/search/?q=git does not include the search form in the top navbar
- http://localhost:1313/15.2/archives does not include the Versions dropdown
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.
Closes #57 (closed)
Edited by Hiru Fernando