Spiral CMS pages module. Allows to create dynamic cms pages and manage them.
Pages contain all previous changes in revisions history.
composer require spiral/pages
spiral register spiral/pages
Need to place navigation links in admin panel? Use example code below:
'pages' => [
'title' => 'Pages',
'icon' => 'description',
'requires' => 'vault.pages',
'items' => [
'pages' => ['title' => 'CMS Pages'],
/*{{navigation.pages}}*/
]
],
In pages config please define page
value - a path to your view file where you will include spiral page tags:
<?php
//Config example
return [
...
'page' => 'spiral-cms-page',
...
];
Example of page view is:
<dark:use path="pages:cms/*" prefix="pages:"/>
<?php
/** @var \Spiral\Pages\Database\Page $page */
?>
<!DOCTYPE html>
<html>
<head>
<pages:meta page="<?= $page ?>"/>
</head>
<body>
<pages:page page="<?= $page ?>"/>
</body>
</html>
pages:meta
tag supports default values, pass keywords
or description
with default values as attributes, tag context will be used as custom html:
<pages:meta page="<?= $page ?>" description="default description" keywords="default,keywords">
<meta name="tags" content="default tags">
</pages:meta>
Only pages in active status are visible for users.
Admins can view them in draft when is is allowed, they need to have viewDraftPermission
defined in pages config.
In this case they will see some notice that this page currently in draft, you can disable notice by
showDraftNotice
value in pages config.
If you have enough permissions (editCMSPermission
value in pages config) you may use inline editor to change page content.
All you need is:
- install
writeaway/writeaway
npm module - define get/set urls for meta data editor and source data editor
- Add visual editor in admin panel