SystemPageExtension reference
Sana.Extensions.SystemPages.SystemPageExtension
is an abstract class that allows a developer to register a custom system pages.
These custom system pages will appear in the "System Pages" list within Sana Admin.
Properties
DefaultUrl
The default system page URL. It is possible to override/translate the default URL on the system page edit page in Sana Admin.
Example:
public override string DefaultUrl => "custom-entities/details";
IsLinkable
The value indicating whether the page is allowed to be shown in the internal page selectors in Sana Admin.
It should return false
if the page depends on required query parameters to present content.
Example:
public override bool IsLinkable => true;
Methods
GetPageTitle
Gets the system page title to be presented in Sana Admin. Sana calls this method and passes the admin area language identifier.
Example:
public override string GetPageTitle(int languageId) => "Custom entity details";
GetSitemapItemGroups
Gets the sitemap item groups for the system page. By default, this method returns the collection with default system page sitemap item group, which includes system page URL translations for each installed language and the system page modification date.
Sana calls this method and passes the instance of SystemPageSitemapItemsLoadOptions and the method returns an enumerable of SystemPageSitemapItemGroup.
Override this method if the current system page presents different content based on query parameters. For example, if the page serves as a "details" page and relies on an "id" query parameter to display specific entities, this method should return a collection of groups for each separate entity.
Example:
public override IEnumerable<SystemPageSitemapItemGroup> GetSitemapItemGroups(SystemPageSitemapItemsLoadOptions options)
{
foreach (var entity in CustomEntityManager.GetList(options.PageIndex, options.PageSize))
{
var group = new Dictionary<int, SystemPageSitemapItem>();
foreach (var (languageId, item) in options.DefaultItemGroup.Items)
group[languageId] = new(Url: $"{item.Url}?id={entity.Id}", ModifiedDate: entity.ModifiedDate);
yield return new(Items: group);
}
}