Pages
CMS main asset defined by its metadata and its HTML content. Locally the metadata and the content are stored individually under the same name but with different file extension (.json and .html)
Localization is supported at page level out-of-the-box by creating one page per every supported language; every supported language will have its own page metadata and content.
How to create and publish a page? #
To publish a page we must perform 3 actions using our CLI.
1. Create a new page
elemental-cms pages create -p home en
2. Push the new page
elemental-cms pages crete -p home en
3. Publish the page
elemental-cms pages publish -p home en
After running the first command 2 files will be created at [your-pages-folder]/en under the names home.json and home.html
home.json
{
"_id": {
"$oid": "625e17d34d4694e590a2a34e"
},
"name": "home",
"language": "en",
"title": "Home",
"description": "",
"isHome": false,
"requiresUserIdentity": false,
"redirectUsersTo": "",
"cssDeps": [],
"jsDeps": [],
"createdAt": {
"$date": 1650333651852
},
"lastModifiedAt": {
"$date": 1650333651852
}
}
home.html
<div></div>
The second command will push the page content and metadata to the pages drafts repository, while the las command will promote the page to the page's repository making it available to the public on the url http://[your-host]/home/.
Accessing the page draft version is possible by adding the parameter draft=1 as query string, like this: http://[your-host]/home/?draft=1
Backup files #
If the page already exists a backup file will be created and stored at [your-pages-folder]/en/.bak/home-[epoch-creation-time].json and [your-pages-folder]/en/.bak/home-[epoch-creation-time].html