Mecha CMS


Default Page Data

Table of Content

These page data will have their own default values.

I have updated the Page class recently so that now we can have more meaningful default page data.


The engine will first search for a hard-coded time data from the page file to be used. If it doesn’t exist, then it uses the page’s file creation time as the page time. But, if the page’s file name itself is formatted as a timestamp-like format, then the engine will try to parse the page’s file name into a valid time data. So now you can set a file name as to set the time data to 2017-04-21 14:25:02 or to set the time data to 2017-04-21 00:00:00. If there is no title field provided in the page file, the title data will be set to 2017/04/21 02:25:02 PM for the first example and 2017/04/21 12:00:00 AM for the second example.


You can now create a page file without the title field but still can have it included to the page output. It is a fake title that is generated from the page’s file name.


Exception for this. There are no plan for making the fake description data which is —you guess— created from the page’s content data. Consider to use the excerpt plugin instead.


The default url value will use the file path that is converted into a public URL by the To::URL() method.


The default id value will use the time value that is converted into unsigned Unix time format as string.


The default type value wil use the page’s file extension that is converted into upper-case words.

Note: If you set some default values explicitly in page configuration property, then those data will be replaced by them. Example:

Config::set('page', [
    'title' => 'My Default Title',
    'type' => 'HTML'