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.
MissingTrailingSlashPagesSystem.Collections.Generic.IReadOnlyList<(string Template, string TypeName)>- 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
.ctor
#public RazorPageContentService(
Assembly[] assemblies,
IFileSystem fileSystem,
FrontMatterParser frontMatterParser,
ILogger<RazorPageContentService> logger);Initializes the service with the assemblies to scan for routable Razor components.
Parameters
assembliesAssembly[]fileSystemIFileSystemfrontMatterParserFrontMatterParserloggerILogger<RazorPageContentService>
Methods
DiscoverAsync
#public async 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>>GetContentToCreateAsync
#public Task<ImmutableList<ContentToCreate>> GetContentToCreateAsync();Files to write into the build output directory.
Returns
Task<ImmutableList<ContentToCreate>>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
{
/// Initializes the service with the assemblies to scan for routable Razor components.
public RazorPageContentService(
Assembly[] assemblies,
IFileSystem fileSystem,
FrontMatterParser frontMatterParser,
ILogger<RazorPageContentService> logger);
/// Default section label applied to discovered items that do not supply one via front matter.
public string DefaultSectionLabel => "";
/// Discover all content items this service is responsible for.
public async 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();
/// Files to write into the build output directory.
public Task<ImmutableList<ContentToCreate>> GetContentToCreateAsync();
/// 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<(string Template, string TypeName)> MissingTrailingSlashPages => _missingTrailingSlashPages;
/// Relative priority for ordering results in the search index (higher values rank first).
public int SearchPriority => 5;
}