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.
Folds over ISiteProjection: every renderable page's post-pipeline HTML is already captured by the shared projection, so this service is a pure adapter from RenderedPage + HtmlToMarkdownConverter to the front-door index, per-subtree index files, and per-page sidecar markdown.
Constructors
LlmsTxtService
#public LlmsTxtService(ISiteProjection projection, IEnumerable<IContentService> contentServices, 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
projectionISiteProjectioncontentServicesIEnumerable<IContentService>subtreesIEnumerable<LlmsSubtree>fileSystemIFileSystemhostingEnvironmentIWebHostEnvironmentpennOptionsPenningtonOptionsllmsTxtOptionsLlmsTxtOptionscanonicalBaseCanonicalBaseUrlnavigationBuilderNavigationBuilderloggerILogger<LlmsTxtService>
Methods
GetLlmsFullTxtAsync
#public Task<string> GetLlmsFullTxtAsync()
Returns the optional concatenated llms-full.txt content, or null when disabled.
Returns
Task<string>GetLlmsTxtAsync
#public Task<string> GetLlmsTxtAsync()
Returns the generated llms.txt index content.
Returns
Task<string>GetMarkdownFilesAsync
#public Task<ImmutableList<MarkdownFile>> GetMarkdownFilesAsync()
Returns the per-page stripped markdown files emitted alongside llms.txt.
Returns
Task<ImmutableList<MarkdownFile>>GetSubtreeFilesAsync
#public Task<ImmutableList<MarkdownFile>> GetSubtreeFilesAsync()
Returns per-subtree {prefix}llms.txt index files split out of the front door.
Returns
Task<ImmutableList<MarkdownFile>>OnFileChanged
#public FileWatchResponse OnFileChanged(FileChangeNotification change)
Called on the file-watcher thread for every watched change. Must be quick and thread-safe.
Parameters
changeFileChangeNotification
Returns
FileWatchResponsePennington.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. Folds over ISiteProjection: every renderable page's post-pipeline HTML is already captured by the shared projection, so this service is a pure adapter from RenderedPage + HtmlToMarkdownConverter to the front-door index, per-subtree index files, and per-page sidecar markdown.
public class LlmsTxtService
{
/// Returns the optional concatenated llms-full.txt content, or null when disabled.
public Task<string> GetLlmsFullTxtAsync()
;
/// Returns the generated llms.txt index content.
public Task<string> GetLlmsTxtAsync()
;
/// Returns the per-page stripped markdown files emitted alongside llms.txt.
public Task<ImmutableList<MarkdownFile>> GetMarkdownFilesAsync()
;
/// Returns per-subtree {prefix}llms.txt index files split out of the front door.
public Task<ImmutableList<MarkdownFile>> GetSubtreeFilesAsync()
;
/// Creates the service; data is computed lazily on first request.
public LlmsTxtService(ISiteProjection projection, IEnumerable<IContentService> contentServices, IEnumerable<LlmsSubtree> subtrees, IFileSystem fileSystem, IWebHostEnvironment hostingEnvironment, PenningtonOptions pennOptions, LlmsTxtOptions llmsTxtOptions, CanonicalBaseUrl canonicalBase, NavigationBuilder navigationBuilder, ILogger<LlmsTxtService> logger)
;
/// Called on the file-watcher thread for every watched change. Must be quick and thread-safe.
public FileWatchResponse OnFileChanged(FileChangeNotification change)
;
}