OutputGenerationService Pennington.Generation
Generates a static site by HTTP-crawling the running app. Pages are fetched in priority order: HTML content first, then MapGet routes (like /styles.css) last. This ensures CSS class collectors have observed all HTML before the stylesheet is generated.
Constructors
.ctor
#public OutputGenerationService(
IEnumerable<IContentService> contentServices,
IEnumerable<IContentEmitter> contentEmitters,
OutputOptions outputOptions,
IWebHostEnvironment environment,
EndpointDataSource endpointDataSource,
IFileSystem fileSystem,
IInProcessHttpDispatcher dispatcher,
ILogger<OutputGenerationService> logger);Initializes the service with the dependencies required to crawl the running app and write output.
Parameters
contentServicesIEnumerable<IContentService>contentEmittersIEnumerable<IContentEmitter>outputOptionsOutputOptionsenvironmentIWebHostEnvironmentendpointDataSourceEndpointDataSourcefileSystemIFileSystemdispatcherIInProcessHttpDispatcherloggerILogger<OutputGenerationService>
Fields
NotFoundGeneratorPathstring- Default:
"/__pennington-404-generator"Sentinel URL fetched during site generation to produce404.html. The path is not a real content route — it exists only to trigger the catch-all fallback handler whose rendered HTML is written to disk. Other parts of the engine (e.g.LocalizationOptions.GetAlternateLanguages) must recognize this sentinel so language switchers on404.htmldon't emit phantom/{locale}/__pennington-404-generator/links.
Methods
GenerateAsync
#public Task<BuildReport> GenerateAsync();Crawls the running app and writes every discovered route to the output directory.
Returns
Task<BuildReport>GenerateAsync
#public async Task<BuildReport> GenerateAsync(bool writeToDisk);Crawls the running app and returns a BuildReport. When writeToDisk is false the output directory is left untouched — the HTTP crawl, diagnostic collection, and link verification still run, which makes this mode suitable for dev-time validators that want the same warnings a real build would produce.
Parameters
writeToDiskbool
Returns
Task<BuildReport>Pennington.Generation.OutputGenerationService
namespace Pennington.Generation;
/// Generates a static site by HTTP-crawling the running app. Pages are fetched in priority order: HTML content first, then MapGet routes (like /styles.css) last. This ensures CSS class collectors have observed all HTML before the stylesheet is generated.
public class OutputGenerationService
{
/// Initializes the service with the dependencies required to crawl the running app and write output.
public OutputGenerationService(
IEnumerable<IContentService> contentServices,
IEnumerable<IContentEmitter> contentEmitters,
OutputOptions outputOptions,
IWebHostEnvironment environment,
EndpointDataSource endpointDataSource,
IFileSystem fileSystem,
IInProcessHttpDispatcher dispatcher,
ILogger<OutputGenerationService> logger);
/// Crawls the running app and writes every discovered route to the output directory.
public Task<BuildReport> GenerateAsync();
/// Crawls the running app and returns a BuildReport. When writeToDisk is false the output directory is left untouched — the HTTP crawl, diagnostic collection, and link verification still run, which makes this mode suitable for dev-time validators that want the same warnings a real build would produce.
public async Task<BuildReport> GenerateAsync(bool writeToDisk);
/// Sentinel URL fetched during site generation to produce 404.html. The path is not a real content route — it exists only to trigger the catch-all fallback handler whose rendered HTML is written to disk. Other parts of the engine (e.g. LocalizationOptions.GetAlternateLanguages) must recognize this sentinel so language switchers on 404.html don't emit phantom /{locale}/__pennington-404-generator/ links.
NotFoundGeneratorPath = "/__pennington-404-generator"
}