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

Skip to main content Skip to navigation

MarkdownContentService Pennington.Content

Discovers and provides markdown content from a directory. When LocalizationOptions has multiple locales, also discovers content from locale subdirectories (e.g., Content/fr/, Content/de/).

Properties

AbsoluteContentRoot string
Absolute filesystem path to the root of this service's content directory.
BasePageUrl Pennington.Routing.UrlPath
URL prefix prepended to routes generated from this content directory.
DefaultSectionLabel string
Default section label applied to discovered items that do not supply one via front matter.
ExcludePaths System.Collections.Immutable.ImmutableArray<string>
Normalized forward-slash subtree paths (relative to the content root) that are skipped during discovery.
SearchPriority int
Relative priority for ordering results in the search index (higher values rank first).

Constructors

.ctor

#
public MarkdownContentService(
    MarkdownContentServiceOptions options,
    FrontMatterParser parser,
    IFileSystem fileSystem,
    IFileWatcher fileWatcher,
    LocalizationOptions localization);

Initializes the service, registers the content directory with the watcher, and prepares lazy metadata loading.

Parameters

options MarkdownContentServiceOptions
parser FrontMatterParser
fileSystem IFileSystem
fileWatcher IFileWatcher
localization LocalizationOptions

Fields

LlmsSubtreeSidecarFileName string
Default: "_llms.yaml"
Sidecar filename that, when dropped at any folder under the content root, declares that folder as an llms.txt subtree.

Methods

DiscoverAsync

#
public async IAsyncEnumerable<DiscoveredItem> DiscoverAsync();

Discover all content items this service is responsible for.

Returns

IAsyncEnumerable<DiscoveredItem>

GetContentTocEntriesAsync

#
public async 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 async Task<ImmutableList<CrossReference>> GetCrossReferencesAsync();

Cross-references for xref resolution.

Returns

Task<ImmutableList<CrossReference>>

GetLlmsSubtreesAsync

#
public Task<ImmutableList<LlmsSubtree>> GetLlmsSubtreesAsync();

Returns the subtrees declared by this provider's content.

Returns

Task<ImmutableList<LlmsSubtree>>

GetRedirectSourcesAsync

#
public async Task<ImmutableList<DiscoveredItem>> GetRedirectSourcesAsync();

Redirect sources this service emits (each item's Source is a RedirectSource). Consumed by RedirectContentService to build the unified redirect map without iterating every service's DiscoverAsync — which would force services that have no redirects to pay the full cost of discovery just to return nothing. Default: empty. Services backed by front-matter records that implement IRedirectable override this.

Returns

Task<ImmutableList<DiscoveredItem>>

Pennington.Content.MarkdownContentService

namespace Pennington.Content;

/// Discovers and provides markdown content from a directory. When LocalizationOptions has multiple locales, also discovers content from locale subdirectories (e.g., Content/fr/, Content/de/).
public class MarkdownContentService
{
    /// Initializes the service, registers the content directory with the watcher, and prepares lazy metadata loading.
    
public MarkdownContentService(
    MarkdownContentServiceOptions options,
    FrontMatterParser parser,
    IFileSystem fileSystem,
    IFileWatcher fileWatcher,
    LocalizationOptions localization);
/// Absolute filesystem path to the root of this service's content directory.
public string AbsoluteContentRoot => _absoluteContentPath;
/// URL prefix prepended to routes generated from this content directory.
public UrlPath BasePageUrl => _options.BasePageUrl;
/// Default section label applied to discovered items that do not supply one via front matter.
public string DefaultSectionLabel => _options.SectionLabel ?? "";
/// Discover all content items this service is responsible for.
public async IAsyncEnumerable<DiscoveredItem> DiscoverAsync();
/// Normalized forward-slash subtree paths (relative to the content root) that are skipped during discovery.
public ImmutableArray<string> ExcludePaths => _normalizedExcludePaths;
/// Navigation entries for table of contents.
public async 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 async Task<ImmutableList<CrossReference>> GetCrossReferencesAsync();
/// Returns the subtrees declared by this provider's content.
public Task<ImmutableList<LlmsSubtree>> GetLlmsSubtreesAsync();
/// Redirect sources this service emits (each item's Source is a RedirectSource). Consumed by RedirectContentService to build the unified redirect map without iterating every service's DiscoverAsync — which would force services that have no redirects to pay the full cost of discovery just to return nothing. Default: empty. Services backed by front-matter records that implement IRedirectable override this.
public async Task<ImmutableList<DiscoveredItem>> GetRedirectSourcesAsync();
/// Sidecar filename that, when dropped at any folder under the content root, declares that folder as an llms.txt subtree.
LlmsSubtreeSidecarFileName = "_llms.yaml"
/// Relative priority for ordering results in the search index (higher values rank first).
public int SearchPriority => _options.SearchPriority;
}