BlogSiteContentService Pennington.BlogSite.Services
Yields content the stock RazorPageContentService cannot: per-tag index routes (Tag.razor's @page "/tags/{TagEncodedName}" template is parameterized and skipped at discovery) plus the /rss.xml feed file. Without these the static build is missing the tag listing pages and the RSS file the BlogSite header links to.
Properties
DefaultSectionLabelstring- Default section label applied to discovered items that do not supply one via front matter.
SearchPriorityint- Relative priority for ordering results in the search index (higher values rank first).
Constructors
.ctor
#public BlogSiteContentService(
BlogSiteOptions options,
FrontMatterParser parser);Creates a new service bound to the supplied options and front-matter parser.
Parameters
optionsBlogSiteOptionsparserFrontMatterParser
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>>GetRssXmlAsync
#public async Task<string> GetRssXmlAsync();Build the RSS 2.0 XML document the /rss.xml endpoint returns. Exposed on the service so the minimal-API handler in UseBlogSite can share cached post metadata with DiscoverAsync.
Returns
Task<string>Pennington.BlogSite.Services.BlogSiteContentService
namespace Pennington.BlogSite.Services;
/// Yields content the stock RazorPageContentService cannot: per-tag index routes (Tag.razor's @page "/tags/{TagEncodedName}" template is parameterized and skipped at discovery) plus the /rss.xml feed file. Without these the static build is missing the tag listing pages and the RSS file the BlogSite header links to.
public class BlogSiteContentService
{
/// Creates a new service bound to the supplied options and front-matter parser.
public BlogSiteContentService(
BlogSiteOptions options,
FrontMatterParser parser);
/// 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();
/// Build the RSS 2.0 XML document the /rss.xml endpoint returns. Exposed on the service so the minimal-API handler in UseBlogSite can share cached post metadata with DiscoverAsync.
public async Task<string> GetRssXmlAsync();
/// Relative priority for ordering results in the search index (higher values rank first).
public int SearchPriority => 0;
}