This site provides a machine-readable index at /llms.txt.

Skip to main content Skip to navigation

SitemapService Pennington.Feeds

Generates sitemap XML for the /sitemap.xml endpoint. Uses AsyncLazy for lazy, thread-safe computation. When managed by FileWatchDependencyFactory, the instance is recreated on file changes — trusts IContentService for fresh metadata.

Enumerates every DiscoverAsync result. For markdown sources, the parser is invoked so Date metadata (lastmod) and IsDraft filtering apply. For programmatic / Razor page sources, the route is emitted with no extra metadata — those content types are rarely dateable and forcing every programmatic generator to run at sitemap-build time would be expensive.

Sitemap, search index, and llms.txt each answer a different question, so they intentionally run different filtering paths:

  • (this service) — every canonical HTML URL a crawler should index. Sourced from DiscoverAsync because Razor / programmatic routes with no TOC entry still need to appear. Per-page search: / llms: opt-outs are honored here: those are search UX preferences, not SEO directives.
  • — enumerates GetIndexableEntriesAsync, which carries ExcludeFromSearch / ExcludeFromLlms flags sourced from search: / llms: front-matter.

Keep these two paths distinct — collapsing them would either leak search opt-outs into the sitemap (bad for SEO) or force every Razor/programmatic source to grow a TOC entry purely so it shows up in the sitemap.

Constructors

.ctor

#
public SitemapService(
    IEnumerable<IContentService> contentServices,
    LocalizationOptions localization,
    IEnumerable<IContentParser> parsers,
    SitemapBuilder builder);

Initializes the service and prepares lazy sitemap generation driven by the provided builder.

Parameters

contentServices IEnumerable<IContentService>
localization LocalizationOptions
parsers IEnumerable<IContentParser>
builder SitemapBuilder

Methods

GetSitemapXmlAsync

#
public Task<string> GetSitemapXmlAsync();

Returns the serialized sitemap XML, generating it on first access and caching the result.

Returns

Task<string>

Pennington.Feeds.SitemapService

namespace Pennington.Feeds;

/// Generates sitemap XML for the /sitemap.xml endpoint. Uses AsyncLazy for lazy, thread-safe computation. When managed by FileWatchDependencyFactory, the instance is recreated on file changes — trusts IContentService for fresh metadata. Enumerates every DiscoverAsync result. For markdown sources, the parser is invoked so Date metadata (lastmod) and IsDraft filtering apply. For programmatic / Razor page sources, the route is emitted with no extra metadata — those content types are rarely dateable and forcing every programmatic generator to run at sitemap-build time would be expensive. Sitemap, search index, and llms.txt each answer a different question, so they intentionally run different filtering paths:
  • (this service) — every canonical HTML URL a crawler should index. Sourced from DiscoverAsync because Razor / programmatic routes with no TOC entry still need to appear. Per-page search: / llms: opt-outs are honored here: those are search UX preferences, not SEO directives.
  • — enumerates GetIndexableEntriesAsync, which carries ExcludeFromSearch / ExcludeFromLlms flags sourced from search: / llms: front-matter.
Keep these two paths distinct — collapsing them would either leak search opt-outs into the sitemap (bad for SEO) or force every Razor/programmatic source to grow a TOC entry purely so it shows up in the sitemap. public class SitemapService { /// Initializes the service and prepares lazy sitemap generation driven by the provided builder.
public SitemapService(
    IEnumerable<IContentService> contentServices,
    LocalizationOptions localization,
    IEnumerable<IContentParser> parsers,
    SitemapBuilder builder);
/// Returns the serialized sitemap XML, generating it on first access and caching the result.
public Task<string> GetSitemapXmlAsync();
}