Contribute to Docs Contribute to Docs

Startup Options

When you add Piranha to your Startup.cs as described in Application Setup, all of the available middleware and routing components are added by default. While this is perfect for most green field websites you may need to control the exactly what parts of the pipeline that are active when integrating Piranha into an existing application.

AddRazorRuntimeCompilation

services.AddPiranha(options =>
{
    options.AddRazorRuntimeCompilation = true;
});

Enables runtime compilation for Razor .cshtml files. This is useful for development environments so that you don't have to restart the application every time you update a view or page. The default value of this property is false as you shouldn't have runtime compilation enabled in production.

DisableRouting

services.AddPiranha(options =>
{
    options.DisableRouting();
});

Convenience method for disabling all Piranha middleware components. This is useful if you're for example building a headless application and only want the manager enabled.

UseAliasRouting

services.AddPiranha(options =>
{
    options.UseAliasRouting = false;
});

If alias routing should be enabled in the middleware pipeline. The default value is true.

UseArchiveRouting

services.AddPiranha(options =>
{
    options.UseArchiveRouting = false;
});

If archive routing should be enabled in the middleware pipeline. The default value is true.

UsePageRouting

services.AddPiranha(options =>
{
    options.UsePageRouting = false;
});

If page routing should be enabled in the middleware pipeline. The default value is true.

UsePostRouting

services.AddPiranha(options =>
{
    options.UsePostRouting = false;
});

If post routing should be enabled in the middleware pipeline. The default value is true.

UseSitemapRouting

services.AddPiranha(options =>
{
    options.UseSitemapRouting = false;
});

If the middleware should listen for and handle incoming requests to /sitemap.xml. The default value is true.

UseSiteRouting

services.AddPiranha(options =>
{
    options.UseSiteRouting = false;
});

If site routing should be enabled in the middleware pipeline. This can be disabled if you only have one site in your application. The default value is true.

UseStartpageRouting

services.AddPiranha(options =>
{
    options.UseStartpageRouting = false;
});

If start page routing should be enabled in the middleware pipeline. The default value is true.