Contribute to Docs Contribute to Docs

Configuration

The configuration in Piranha can be updated both from the manager interface and from code. To set the configuration in you Startup just inject Piranha.Config into your Configure method.

public void Configure(..., Piranha.Config config)
{
    ...
}

Application configuration

ArchivePageSize

config.ArchivePageSize = 0;

The number of posts that should be returned when loading an archive. A value of 0 means that all available posts will be returned. The default value is 0.

CacheExpiresPages

config.CacheExpiresPages = 0;

The number of minutes the browser should be allowed to cache pages before asking the server for a new version. A value of 0 means that HTTP cache is disabled and that no-cache headers will be returned to the browser. The default value is 0.

CacheExpiresPosts

config.CacheExpiresPosts = 0;

The number of minutes the browser should be allowed to cache posts before asking the server for a new version. A value of 0 means that HTTP cache is disabled and that no-cache headers will be returned to the browser. The default value is 0.

CommentsApprove

config.CommentsApprove = true;

If new comments should automatically be approved. The default value is true.

CommentsCloseAfterDays

config.CommentsCloseAfterDays = 0;

The number of days after publish date comments should be open. A value of 0 means that comments will be open forever. The default value is 0.

CommentsEnabledForPages

config.CommentsEnabledForPages = false;

If comments should be enabled by default for pages. Please note that this setting can be overridden on specific pages. The default value is false.

CommentsEnabledForPosts

config.CommentsEnabledForPosts = true;

If comments should be enabled by default for posts. Please note that this setting can be overridden on specific posts. The default value is true.

CommentsPageSize

config.CommentsPageSize = 0;

The number of comments that should be returned when loading a comment list. A value of 0 means that all available comments will be returned. The default value is 0.

HtmlExcerpt

config.HtmlExcerpt = false;

If the Page & Post excerpt should be in HTML or in plain text. The defailt value is false.

MediaCDN

config.MediaCDN = "";

The base url to the media CDN that should be used when referencing uploaded media assets. An empty value means no CDN is configured and that the base address to the media asset is used. The default value is null.

PageRevisions

config.PageRevisions = 10;

The number of revisions that should be kept in the database for pages. A value of 0 means all revisions will be saved. The default value is 10.

PostRevisions

config.PostRevisions = 10;

The number of revisions that should be kept in the database for posts. A value of 0 means all revisions will be saved. The default value is 10.

Manager configuration

HierarchicalPageSlugs

config.HierarchicalPageSlugs = true;

If hierarchical slugs should be generated for pages. The default value is true.

ManagerDefaultCollapsedBlockGroupHeaders

config.ManagerDefaultCollapsedBlockGroupHeaders = false;

If global fields for Block Groups should be collapsed by default in the manager interface. The default value is false.

ManagerDefaultCollapsedBlocks

config.ManagerDefaultCollapsedBlocks = false;

If blocks should be collapsed by default when editing a Page or Post in the manager interface. The default value is false.

ManagerExpandedSitemapLevels

config.ManagerExpandedSitemapLevels = 0;

The number of levels in the sitemap that should be expanded by default in the manager interface. The default value is 0.

ManagerPageSize

config.ManagerPageSize = 15;

The number of items that should be returned in lists in the manager interface. A value of 0 means that all available items will be returned. The default value is 15.