Adds categoryMappings array to config from json file #5236
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces support for a new categoryMappings field within the Milo JSON configuration. The goal is to provide more flexible and granular control over category-to-template mappings without requiring code changes.
What’s Changed
Added categoryMappings support in the CaaS Collection Configurator.
Updated logic to read category mapping rules from JSON instead of relying on hard-coded behavior.
Ensured backward compatibility when categoryMappings is absent.
Minor cleanup and structural alignment with existing config parsing.
Why This Is Needed
Some page types require custom category logic that cannot currently be expressed through the existing config. Allowing mappings to be defined in milo.json gives authors and integrators more control while reducing engineering overhead.
How It Works
The JSON config may now include a categoryMappings array.
Each mapping defines a category key and the corresponding template or behavior.
If categoryMappings is not provided, the system falls back to default behavior.
Testing
Verified that pages load expected templates when categoryMappings is present.
Confirmed that existing pages behave unchanged when the field is omitted.
Manually tested with multiple mapping configurations to verify precedence and fallback logic.
Resolves: MWPW-185006
Test URLs: