Skip to main content

register_taxonomy

Macro register_taxonomy 

Source
macro_rules! register_taxonomy {
    ($ty:ty) => { ... };
}
Expand description

Register a custom taxonomy / category vocabulary. The type must implement TaxonomyHandler and Default. Mirrors register_page_type! — drop the call anywhere in the crate’s source and the vocabulary is synced into a cms_taxonomy row at seed and shows up under the admin Taxonomies section.

Extra typed fields go in the handler’s own per-type extension table (unique category_id FK), the same way a page type extends cms_page.

ⓘ
use rustango_cms::register_taxonomy;
use rustango_cms::category::TaxonomyHandler;

#[derive(Default)]
pub struct RegionTaxonomy;
impl TaxonomyHandler for RegionTaxonomy {
    fn slug(&self) -> &'static str { "region" }
    fn verbose_name(&self) -> &'static str { "Regions" }
}
register_taxonomy!(RegionTaxonomy);