DocSiteContentResolver
Pennington.DocSite.Services
The DocSite's per-request content facade. Resolves a page by URL (delegating the discover → parse → render step to the core IPageResolver) and adds the DocSite-specific concerns around it: locale detection with fallback to the default locale, the ResolvedContent view-model, navigation/TOC, alternate languages, and area scoping. Distinct from IPageResolver, which is the locale-naive single-page primitive shared with bare hosts.
Constructors
DocSiteContentResolver
#public DocSiteContentResolver(IEnumerable<IContentService> services, IPageResolver pageResolver, NavigationBuilder navBuilder, LocalizationOptions localization, DocSiteOptions docSiteOptions, BlogFeature blog, IContentParser parser = null, IContentRenderer renderer = null)
Creates a new resolver with the supplied content services, page resolver, options, and pipeline primitives.
Parameters
servicesIEnumerable<IContentService>pageResolverIPageResolvernavBuilderNavigationBuilderlocalizationLocalizationOptionsdocSiteOptionsDocSiteOptionsblogBlogFeatureparserIContentParserrendererIContentRenderer
Methods
GetAlternateLanguagesAsync
#public Task<ImmutableList<AlternateLanguage>> GetAlternateLanguagesAsync(string url)
Get alternate language versions for a page URL. Always includes all configured locales — fallback resolution handles missing translations. Delegates the URL math to GetAlternateLanguages.
Parameters
urlstring
Returns
Task<ImmutableList<AlternateLanguage>>GetContentByUrlAsync
#public Task<ResolvedContent> GetContentByUrlAsync(string url)
Get rendered content for a URL. Returns null if not found. Handles locale detection and fallback to default locale.
Parameters
urlstring
Returns
Task<ResolvedContent>GetNavigationInfoAsync
#public Task<NavigationInfo> GetNavigationInfoAsync(string url)
Get navigation info for a URL, filtered by locale.
Parameters
urlstring
Returns
Task<NavigationInfo>GetNavigationInfoForAreaAsync
#public Task<NavigationInfo> GetNavigationInfoForAreaAsync(string url, ContentArea area)
Get navigation info (prev/next/breadcrumbs) scoped to an area. When area is null, falls back to the full-site navigation.
Parameters
urlstringareaContentArea
Returns
Task<NavigationInfo>GetNotFoundContentAsync
#public Task<ResolvedContent> GetNotFoundContentAsync()
Resolves the site's not-found body from a content-root 404.md, rendered through the full markdown pipeline. Returns null when no 404.md exists (the catch-all then tries a NotFound component, then the built-in message) or when the host registered no markdown parser. The file is reserved out of discovery (ReserveNotFoundPage), so it is never a routable page. One body serves every locale: the static build emits a single root 404.html, which is all any static host serves for an unknown URL.
Returns
Task<ResolvedContent>GetTocItemsAsync
#public Task<IReadOnlyList<ContentTocItem>> GetTocItemsAsync(string locale = null)
Get all TOC items, optionally filtered by locale.
Parameters
localestring
Returns
Task<IReadOnlyList<ContentTocItem>>GetTocItemsForAreaAsync
#public Task<IReadOnlyList<ContentTocItem>> GetTocItemsForAreaAsync(string locale, ContentArea area)
Get TOC items scoped to a specific area. Filters by area slug matching HierarchyParts[0] and strips the area prefix, mirroring the locale-stripping pattern in NavigationBuilder.
Parameters
localestringareaContentArea
Returns
Task<IReadOnlyList<ContentTocItem>>ResolveCurrentArea
#public ContentArea ResolveCurrentArea(string url)
Resolves which content area the given URL belongs to, based on the first path segment matching a configured area slug. Returns null if no area matches.
Parameters
urlstring
Returns
ContentAreaPennington.DocSite.Services.DocSiteContentResolver
namespace Pennington.DocSite.Services;
/// The DocSite's per-request content facade. Resolves a page by URL (delegating the discover → parse → render step to the core IPageResolver) and adds the DocSite-specific concerns around it: locale detection with fallback to the default locale, the ResolvedContent view-model, navigation/TOC, alternate languages, and area scoping. Distinct from IPageResolver, which is the locale-naive single-page primitive shared with bare hosts.
public class DocSiteContentResolver
{
/// Creates a new resolver with the supplied content services, page resolver, options, and pipeline primitives.
public DocSiteContentResolver(IEnumerable<IContentService> services, IPageResolver pageResolver, NavigationBuilder navBuilder, LocalizationOptions localization, DocSiteOptions docSiteOptions, BlogFeature blog, IContentParser parser = null, IContentRenderer renderer = null)
;
/// Get alternate language versions for a page URL. Always includes all configured locales — fallback resolution handles missing translations. Delegates the URL math to GetAlternateLanguages.
public Task<ImmutableList<AlternateLanguage>> GetAlternateLanguagesAsync(string url)
;
/// Get rendered content for a URL. Returns null if not found. Handles locale detection and fallback to default locale.
public Task<ResolvedContent> GetContentByUrlAsync(string url)
;
/// Get navigation info for a URL, filtered by locale.
public Task<NavigationInfo> GetNavigationInfoAsync(string url)
;
/// Get navigation info (prev/next/breadcrumbs) scoped to an area. When area is null, falls back to the full-site navigation.
public Task<NavigationInfo> GetNavigationInfoForAreaAsync(string url, ContentArea area)
;
/// Resolves the site's not-found body from a content-root 404.md, rendered through the full markdown pipeline. Returns null when no 404.md exists (the catch-all then tries a NotFound component, then the built-in message) or when the host registered no markdown parser. The file is reserved out of discovery (ReserveNotFoundPage), so it is never a routable page. One body serves every locale: the static build emits a single root 404.html, which is all any static host serves for an unknown URL.
public Task<ResolvedContent> GetNotFoundContentAsync()
;
/// Get all TOC items, optionally filtered by locale.
public Task<IReadOnlyList<ContentTocItem>> GetTocItemsAsync(string locale = null)
;
/// Get TOC items scoped to a specific area. Filters by area slug matching HierarchyParts[0] and strips the area prefix, mirroring the locale-stripping pattern in NavigationBuilder.
public Task<IReadOnlyList<ContentTocItem>> GetTocItemsForAreaAsync(string locale, ContentArea area)
;
/// Resolves which content area the given URL belongs to, based on the first path segment matching a configured area slug. Returns null if no area matches.
public ContentArea ResolveCurrentArea(string url)
;
}