formwork
formwork copied to clipboard
Page taxonomies
This pull request refactors the handling of tags in the Formwork CMS to support a more flexible taxonomy system. Tags are now treated as a type of taxonomy, enabling future support for additional taxonomies beyond just tags. The changes include updates to routes, data structures, filtering logic, and deprecation notices, ensuring backward compatibility and extensibility.
Taxonomy system introduction and migration
- Replaced the old tag-specific routes and logic with generic taxonomy-based routes in
routes.php, allowing for filtering and pagination by any taxonomy defined in the site config. - Updated post metadata in markdown files and page schemes to use the new
taxonomystructure instead oftags, and adjusted templates to display taxonomy terms. [1] [2] [3] [4] [5] [6]
Core data model and API changes
- Added
taxonomysupport to thePageclass, including getter and setter methods with validation, and included taxonomy in page defaults. [1] [2] - Implemented a new
havingTaxonomymethod inPageCollectionto filter pages by taxonomy terms, supporting both plain and slug matching.
Routing engine enhancements
- Added parameter constraints to the routing system, allowing routes to validate taxonomy names against those defined in the site configuration, and ensured constraints are checked during dispatch. [1] [2] [3] [4]
Deprecation and compatibility
- Deprecated the
allowTagsscheme option in favor ofallowTaxonomy, with a deprecation warning, and updated code to check for the new option. [1] [2]
Configuration updates
- Added a
taxonomiesentry to the site configuration, initializing it withtagfor backward compatibility and future extensibility.