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:

  1. 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.
  2. 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:

  1. https://product-14293-direction-paths.about.gitlab-review.app/direction/
  2. https://product-14293-direction-paths.about.gitlab-review.app/direction/paid_tiers/
  3. https://product-14293-direction-paths.about.gitlab-review.app/direction/ops/
  4. https://product-14293-direction-paths.about.gitlab-review.app/direction/ci/
  5. https://product-14293-direction-paths.about.gitlab-review.app/direction/delivery/
  6. https://product-14293-direction-paths.about.gitlab-review.app/direction/data-science/
  7. 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.md explaining the new system

2. Automated Path Generation

  • Auto-generates section paths from sections.yml using 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.rb to dynamically generate stage constants from YAML
  • Updated: sites/uncategorized/config.rb to 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

Merge request reports

Loading