LlmsTxtService Pennington.LlmsTxt
Generates llms.txt index and stripped markdown files. When managed by FileWatchDependencyFactory, the instance is recreated on file changes — no manual watcher subscription needed.
Markdown bodies come from the same IContentRenderer the build pipeline uses, so the output reflects Markdig extensions and Razor-component SSR (Mdazor) without an HTTP self-fetch.
Constructors
.ctor
#public LlmsTxtService(
IEnumerable<IContentService> contentServices,
IContentParser parser,
IContentRenderer renderer,
XrefResolvingService xrefResolver,
RenderedHtmlFetcher fetcher,
IEnumerable<LlmsSubtree> subtrees,
IFileSystem fileSystem,
IWebHostEnvironment hostingEnvironment,
PenningtonOptions pennOptions,
LlmsTxtOptions llmsTxtOptions,
CanonicalBaseUrl canonicalBase,
NavigationBuilder navigationBuilder,
ILogger<LlmsTxtService> logger);Creates the service; data is computed lazily on first request.
Parameters
contentServicesIEnumerable<IContentService>parserIContentParserrendererIContentRendererxrefResolverXrefResolvingServicefetcherRenderedHtmlFetchersubtreesIEnumerable<LlmsSubtree>fileSystemIFileSystemhostingEnvironmentIWebHostEnvironmentpennOptionsPenningtonOptionsllmsTxtOptionsLlmsTxtOptionscanonicalBaseCanonicalBaseUrlnavigationBuilderNavigationBuilderloggerILogger<LlmsTxtService>
Methods
GetLlmsFullTxtAsync
#public async Task<string?> GetLlmsFullTxtAsync();Returns the optional concatenated llms-full.txt content, or null when disabled.
Returns
Task<string?>GetLlmsTxtAsync
#public async Task<string> GetLlmsTxtAsync();Returns the generated llms.txt index content.
Returns
Task<string>GetMarkdownFilesAsync
#public async Task<ImmutableList<MarkdownFile>> GetMarkdownFilesAsync();Returns the per-page stripped markdown files emitted alongside llms.txt.
Returns
Task<ImmutableList<LlmsTxtService.MarkdownFile>>GetSubtreeFilesAsync
#public async Task<ImmutableList<MarkdownFile>> GetSubtreeFilesAsync();Returns per-subtree {prefix}llms.txt index files split out of the front door.
Returns
Task<ImmutableList<LlmsTxtService.MarkdownFile>>Pennington.LlmsTxt.LlmsTxtService
namespace Pennington.LlmsTxt;
/// Generates llms.txt index and stripped markdown files. When managed by FileWatchDependencyFactory, the instance is recreated on file changes — no manual watcher subscription needed. Markdown bodies come from the same IContentRenderer the build pipeline uses, so the output reflects Markdig extensions and Razor-component SSR (Mdazor) without an HTTP self-fetch.
public class LlmsTxtService
{
/// Creates the service; data is computed lazily on first request.
public LlmsTxtService(
IEnumerable<IContentService> contentServices,
IContentParser parser,
IContentRenderer renderer,
XrefResolvingService xrefResolver,
RenderedHtmlFetcher fetcher,
IEnumerable<LlmsSubtree> subtrees,
IFileSystem fileSystem,
IWebHostEnvironment hostingEnvironment,
PenningtonOptions pennOptions,
LlmsTxtOptions llmsTxtOptions,
CanonicalBaseUrl canonicalBase,
NavigationBuilder navigationBuilder,
ILogger<LlmsTxtService> logger);
/// Returns the optional concatenated llms-full.txt content, or null when disabled.
public async Task<string?> GetLlmsFullTxtAsync();
/// Returns the generated llms.txt index content.
public async Task<string> GetLlmsTxtAsync();
/// Returns the per-page stripped markdown files emitted alongside llms.txt.
public async Task<ImmutableList<MarkdownFile>> GetMarkdownFilesAsync();
/// Returns per-subtree {prefix}llms.txt index files split out of the front door.
public async Task<ImmutableList<MarkdownFile>> GetSubtreeFilesAsync();
}