This documentation is also published as Markdown for efficient machine reading: the whole site is indexed at /llms.txt, and every page has a clean Markdown copy at the same URL with .md appended. These are generated from the same source and cost far fewer tokens to read than this rendered HTML.

Skip to main content Skip to navigation

TaxonomyServiceExtensions Pennington.Taxonomy

DI + endpoint helpers for registering and mounting taxonomy axes (browse-by-tag, browse-by-cuisine, browse-by-audience, ...).

Methods

AddTaxonomy<TFrontMatter, TKey>

#
public static IServiceCollection AddTaxonomy<TFrontMatter, TKey>(IServiceCollection services, Action<TaxonomyOptions<TFrontMatter, TKey>> configure)

Registers a TaxonomyContentService configured by configure. Multiple AddTaxonomy calls with the same TFrontMatter/TKey pair coexist as long as each uses a distinct BaseUrl.

Parameters

services IServiceCollection
configure Action<TaxonomyOptions<TFrontMatter, TKey>>

Returns

IServiceCollection

MapTaxonomy<TFrontMatter, TKey>

#
public static IEndpointRouteBuilder MapTaxonomy<TFrontMatter, TKey>(IEndpointRouteBuilder routes)

Mounts the live HTTP endpoints for every TaxonomyContentService registered for the given type pair. The index URL renders IndexPage with a Terms parameter; per-term URLs render TermPage with a Term parameter.

Parameters

routes IEndpointRouteBuilder

Returns

IEndpointRouteBuilder

Pennington.Taxonomy.TaxonomyServiceExtensions

namespace Pennington.Taxonomy;

/// DI + endpoint helpers for registering and mounting taxonomy axes (browse-by-tag, browse-by-cuisine, browse-by-audience, ...).
public class TaxonomyServiceExtensions
{
    /// Registers a TaxonomyContentService configured by configure. Multiple AddTaxonomy calls with the same TFrontMatter/TKey pair coexist as long as each uses a distinct BaseUrl.
    
public static IServiceCollection AddTaxonomy<TFrontMatter, TKey>(IServiceCollection services, Action<TaxonomyOptions<TFrontMatter, TKey>> configure)
; /// Mounts the live HTTP endpoints for every TaxonomyContentService registered for the given type pair. The index URL renders IndexPage with a Terms parameter; per-term URLs render TermPage with a Term parameter.
public static IEndpointRouteBuilder MapTaxonomy<TFrontMatter, TKey>(IEndpointRouteBuilder routes)
; }