Refactor direction path generation to share methods and YAML config
This refactor makes the direction page system more maintainable and configurable, it removes hard-coded values in favour of a new direction path config YAML file, with related documentation.
It also:
- adds CI configuration to clear cache when direction related files change as they were causing build issues because the cache would have outdated sections/stages data.
- renamed or removed files causing build issues as the section/stage no longer exists.
The refactor will allow reuse of the methods for validation in data/stages.yml and data/sections.yml.
Verification
Ensured that these paths all still get built:
- https://product-14293-direction-paths.about.gitlab-review.app/direction/
- https://product-14293-direction-paths.about.gitlab-review.app/direction/paid_tiers/
- https://product-14293-direction-paths.about.gitlab-review.app/direction/ops/
- https://product-14293-direction-paths.about.gitlab-review.app/direction/ci/
- https://product-14293-direction-paths.about.gitlab-review.app/direction/delivery/
- https://product-14293-direction-paths.about.gitlab-review.app/direction/data-science/
- https://product-14293-direction-paths.about.gitlab-review.app/direction/security/
AI summary
This MR is a major refactoring that centralizes direction path generation through shared methods and YAML configuration:
Key Changes:
1. New Configuration System
- Added:
data/direction_path_config.yml- Central configuration for direction page generation - Added:
lib/direction_path_generator.rb- New module to handle path generation logic - Added: Comprehensive documentation in
data/README.mdexplaining the new system
2. Automated Path Generation
- Auto-generates section paths from
sections.ymlusing standard patterns - Only requires configuration for special cases (combined sections, custom paths, skipped pages)
- Eliminates hardcoded path mappings in favor of YAML-driven configuration
3. Code Refactoring
- Updated:
generators/direction.rbto dynamically generate stage constants from YAML - Updated:
sites/uncategorized/config.rbto use the new path generator system - Added: Validation in YAML checkers to ensure direction paths match expected patterns
4. Path Updates
- Added: Redirect from
/direction/deploy/to/direction/delivery/ - Removed: Old deploy template that was just a redirect
Impact
- Simplifies adding new direction pages
- Reduces code duplication and hardcoded mappings
- Improves maintainability through centralized configuration
Edited by Cynthia "Arty" Ng