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
servicesIEnumerable<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
baseUrlstring- 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
baseUrlstring- The axis
BaseUrl. slugstring- 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)
;
}