formwork icon indicating copy to clipboard operation
formwork copied to clipboard

Page taxonomies

Open giuscris opened this issue 2 months ago • 0 comments

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 taxonomy structure instead of tags, and adjusted templates to display taxonomy terms. [1] [2] [3] [4] [5] [6]

Core data model and API changes

  • Added taxonomy support to the Page class, including getter and setter methods with validation, and included taxonomy in page defaults. [1] [2]
  • Implemented a new havingTaxonomy method in PageCollection to 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 allowTags scheme option in favor of allowTaxonomy, with a deprecation warning, and updated code to check for the new option. [1] [2]

Configuration updates

  • Added a taxonomies entry to the site configuration, initializing it with tag for backward compatibility and future extensibility.

giuscris avatar Nov 06 '25 21:11 giuscris