RazorPageContentService
Pennington.Content
Discovers @page Razor components for the content pipeline. Scans configured assemblies for types inheriting ComponentBase with non-parameterized [RouteAttribute] routes. Optionally loads metadata from sidecar .razor.metadata.yml files placed alongside the component.
Properties
DefaultSectionLabelstring- Default section label applied to discovered items that do not supply one via front matter.
MissingTrailingSlashPagesIReadOnlyList<ValueTuple<string, string>>- Razor @page directives that were missing a trailing slash. Populated after
DiscoverAsyncruns. SearchPriorityint- Relative priority for ordering results in the search index (higher values rank first).
Constructors
RazorPageContentService
#public RazorPageContentService(Assembly[] assemblies, IFileSystem fileSystem, FrontMatterParser frontMatterParser, ILogger<RazorPageContentService> logger, string contentRootPath = null, TimeProvider clock = null)
Initializes the service with the assemblies to scan for routable Razor components. contentRootPath (the host content root) seeds the sidecar file scan alongside the assembly-location walkup — required under a centralized artifacts output, where no .csproj lives above the compiled binary.
Parameters
assembliesAssembly[]fileSystemIFileSystemfrontMatterParserFrontMatterParserloggerILogger<RazorPageContentService>contentRootPathstringclockTimeProvider
Methods
DiscoverAsync
#public IAsyncEnumerable<DiscoveredItem> DiscoverAsync()
Discover all content items this service is responsible for.
Returns
IAsyncEnumerable<DiscoveredItem>GetContentTocEntriesAsync
#public Task<ImmutableList<ContentTocItem>> GetContentTocEntriesAsync()
Navigation entries for table of contents.
Returns
Task<ImmutableList<ContentTocItem>>GetContentToCopyAsync
#public Task<ImmutableList<ContentToCopy>> GetContentToCopyAsync()
Static files to copy to output (images, downloads, etc.)
Returns
Task<ImmutableList<ContentToCopy>>GetCrossReferencesAsync
#public Task<ImmutableList<CrossReference>> GetCrossReferencesAsync()
Cross-references for xref resolution.
Returns
Task<ImmutableList<CrossReference>>GetIndexableEntriesAsync
#public Task<ImmutableList<ContentTocItem>> GetIndexableEntriesAsync()
Entries that should appear in the search index and llms.txt.
Default: returns GetContentTocEntriesAsync. That is correct when "shown in navigation" ≡ "discoverable via search" — the default holds for markdown, because MarkdownContentService's TOC entries already honor search: and llms: front-matter fields via ExcludeFromSearch / ExcludeFromLlms.
Override when the two sets diverge — for example, RazorPageContentService emits sidecar-less pages here (so users can search for them) without adding them to navigation (which would clutter the TOC with auto-titled entries).
Implementors of custom content services that build ContentTocItems directly: set ExcludeFromSearch and ExcludeFromLlms from your metadata's Search / Llms flags, or per-page opt-outs will be silently ignored.
Returns
Task<ImmutableList<ContentTocItem>>Pennington.Content.RazorPageContentService
namespace Pennington.Content;
/// Discovers @page Razor components for the content pipeline. Scans configured assemblies for types inheriting ComponentBase with non-parameterized [RouteAttribute] routes. Optionally loads metadata from sidecar .razor.metadata.yml files placed alongside the component.
public class RazorPageContentService
{
/// Default section label applied to discovered items that do not supply one via front matter.
public string DefaultSectionLabel { get; }
/// Discover all content items this service is responsible for.
public IAsyncEnumerable<DiscoveredItem> DiscoverAsync()
;
/// Navigation entries for table of contents.
public Task<ImmutableList<ContentTocItem>> GetContentTocEntriesAsync()
;
/// Static files to copy to output (images, downloads, etc.)
public Task<ImmutableList<ContentToCopy>> GetContentToCopyAsync()
;
/// Cross-references for xref resolution.
public Task<ImmutableList<CrossReference>> GetCrossReferencesAsync()
;
/// Entries that should appear in the search index and llms.txt. Default: returns GetContentTocEntriesAsync. That is correct when "shown in navigation" ≡ "discoverable via search" — the default holds for markdown, because MarkdownContentService's TOC entries already honor search: and llms: front-matter fields via ExcludeFromSearch / ExcludeFromLlms.Override when the two sets diverge — for example, RazorPageContentService emits sidecar-less pages here (so users can search for them) without adding them to navigation (which would clutter the TOC with auto-titled entries).Implementors of custom content services that build ContentTocItems directly: set ExcludeFromSearch and ExcludeFromLlms from your metadata's Search / Llms flags, or per-page opt-outs will be silently ignored.
public Task<ImmutableList<ContentTocItem>> GetIndexableEntriesAsync()
;
/// Razor @page directives that were missing a trailing slash. Populated after DiscoverAsync runs.
public IReadOnlyList<ValueTuple<string, string>> MissingTrailingSlashPages { get; }
/// Initializes the service with the assemblies to scan for routable Razor components. contentRootPath (the host content root) seeds the sidecar file scan alongside the assembly-location walkup — required under a centralized artifacts output, where no .csproj lives above the compiled binary.
public RazorPageContentService(Assembly[] assemblies, IFileSystem fileSystem, FrontMatterParser frontMatterParser, ILogger<RazorPageContentService> logger, string contentRootPath = null, TimeProvider clock = null)
;
/// Relative priority for ordering results in the search index (higher values rank first).
public int SearchPriority { get; }
}