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 under /_llms/. 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

TaxonomyAccessor Pennington.Taxonomy

Resolves the registered TaxonomyContentService for a given BaseUrl so a routed Razor @page can read a taxonomy's terms directly — the alternative to mounting the bare-render MapTaxonomy endpoints when the page wants the host's full layout, chrome, and search indexing.

Constructors

TaxonomyAccessor

#
public TaxonomyAccessor(IEnumerable<IContentService> services)

Creates the accessor over the registered content services.

Parameters

services IEnumerable<IContentService>

Methods

GetTermsAsync<TFrontMatter, TKey>

#
public Task<ImmutableList<TaxonomyTerm<TFrontMatter, TKey>>> GetTermsAsync<TFrontMatter, TKey>(string baseUrl)

Returns the term list for the axis mounted at baseUrl, or empty when none matches.

Parameters

baseUrl string
The axis BaseUrl.

Returns

Task<ImmutableList<TaxonomyTerm<TFrontMatter, TKey>>>

TryGetTermAsync<TFrontMatter, TKey>

#
public Task<TaxonomyTerm<TFrontMatter, TKey>> TryGetTermAsync<TFrontMatter, TKey>(string baseUrl, string slug)

Looks up a single term by slug on the axis mounted at baseUrl; null when absent.

Parameters

baseUrl string
The axis BaseUrl.
slug string
The term slug to resolve.

Returns

Task<TaxonomyTerm<TFrontMatter, TKey>>

Pennington.Taxonomy.TaxonomyAccessor

namespace Pennington.Taxonomy;

/// Resolves the registered TaxonomyContentService for a given BaseUrl so a routed Razor @page can read a taxonomy's terms directly — the alternative to mounting the bare-render MapTaxonomy endpoints when the page wants the host's full layout, chrome, and search indexing.
public class TaxonomyAccessor
{
    /// Returns the term list for the axis mounted at baseUrl, or empty when none matches.
    
public Task<ImmutableList<TaxonomyTerm<TFrontMatter, TKey>>> GetTermsAsync<TFrontMatter, TKey>(string baseUrl)
; /// Creates the accessor over the registered content services.
public TaxonomyAccessor(IEnumerable<IContentService> services)
; /// Looks up a single term by slug on the axis mounted at baseUrl; null when absent.
public Task<TaxonomyTerm<TFrontMatter, TKey>> TryGetTermAsync<TFrontMatter, TKey>(string baseUrl, string slug)
; }