4. Pages
A page is a page that a visitor of the site can view.
A page is composed of 6-9 attributes
The title
The public title of the page. Possibly also used for menu's depending on how that entity is built.
The path
The path/URL that maps to this page. The part after /p/.
An optional internal description
Just an internal description of the page.
A list of page components
A actual content of the page. A list of child records.
Optionally some body-classes
A place to add some custom css classes. Doesn't have to be a text input, could be a drop down instead, eg. with background colors.
A wrapper
The ID of the wrapper that the page should use. Use an Enumeration or a sql-lookup.
A stylesheet
The ID of the stylesheet that the page should use. Use an Enumeration or a sql-lookup.
Option to cache the output
A yes/no that allows the content administrator to cache the rendered page, for faster browsing.
A "preview page"-button
A button that calls the the codeunit com.tsnocode.core.cms.ShowPage to show what the page looks like to an end user.
Configuration
This entity makes use of a codeunit named com.tsnocode.core.cms.PageEventHandler to maintain redirects, when the path changes.
The codeunit is controlled via the System configuration that start with Cms.Redirects..
The rendering engine uses a couple of configurations that live in the configurations for this entity.
Here is a table of all the available configurations, none of them have default values, but most are needed.
| Name |
Description |
| CmsBlock.CacheEnabledField | Field in the page content entity, that enables caching of the output |
| CmsBlock.TemplateField | Field in the page content entity, that Contains a Template ID or raw HTML |
| CmsPage.BlockListfield | Field in this entity, that contains the page content |
| CmsPage.CacheEnabledField | Field in this entity, that enables caching of the output |
| CmsPage.CssClassField | Field in this entity, that contains classes to add to the body tag |
| CmsPage.StylesheetField | Field in this entity, that contains the Stylesheet ID |
| CmsPage.TitleField | Field in this entity, that contains the name of the page |
| CmsPage.WrapperField | Field in this entity, that contains the Wrapper ID |
Sample setup:
Headers and scripts
This is the simple script that helps build a path based on the given title.
<script type="text/javascript">
const keepUrlSafeChars = input => {
if (!input)
return input;
return input
.toLowerCase()
.replace(" ", "-")
.replace(/[^a-zA-Z0-9\/_-]/g, '');
}
</script>
$("#DATA_TITLE").on("change keyup", () => {
setValue("PATH", keepUrlSafeChars(getValue("TITLE")))
})

