Stereotype Extension
About
An extension by Aissac that adds templating support to Radiant CMS.
Tested on Radiant 0.7.1, 0.8 and 0.9 RC1.
Features
- Define named templates (stereotypes) for Pages;
- Templates are assigned per-parent Page, making all children have the defined ‘stereotype’ by their parent;
- You can specify the new page’s parts, filters, layout, page type, status or stereotype.
Important Notice!
The git branches of the github repository hold stable versions of the extension for older versions of Radiant CMS. For example the 0.8 branch is compatible with Radiant 0.8.
To checkout one of these branches:
1 2 3 4 | git clone git://github.com/Aissac/radiant-stereotype-extension.git\ vendor/extensions/stereotype cd vendor/extensions/stereotype git checkout -b <branch-name> origin/<remote-branch-name> |
As an example if you’re working on Radiant 0.8 you will need to checkout the 0.8 branch:
1 2 | cd vendor/extensions/stereotype git checkout -b my_branch origin/0.8 |
Instalation
Stereotype Extension has one dependency, the Radiant Custom Fields Extension.
1 2 | git clone git://github.com/Aissac/radiant-custom-fields-extension.git\ vendor/extensions/custom_fields |
Because Stereotype Extension keeps the settings in the Radiant::Config table it is highly recommended to install the Settings Extension
1 2 | git clone git://github.com/Squeegy/radiant-settings.git\ vendor/extensions/settings |
Finally, install the Stereotype Extension
1 2 | git clone git://github.com/Aissac/radiant-stereotype-extension.git\ vendor/extensions/stereotype |
Configuration
To add stereotypes you need to add fields to the Radiant::Config table. There are five types of settings for each stereotype:
- Page Parts (and filters)
The key has to look like:
stereotype.<name_of_the_stereotype>.partsand the valuebody:markdown,sidebar:textile. - Layout
The key has to look like:
stereotype.<name_of_the_stereotype>.layoutand the value has to be the name of a layout (case sensitive) - Page type
The key should look like:
stereotype.<name_of_the_stereotype>.page_typeand the value has to be a validclass_nameattribute of the Page class. (Examples: ArchivePage, FileNotFoundPage or ArchiveMonthIndexPage) - Status
The key should look like:
stereotype.<name_of_the_stereotype>.statusand the value has to be a validstatusattribute of the Page class: draft, hidden, reviewed, published - Stereotype
The key should look like:
stereotype.<name_of_the_stereotype>.stereotypeand the value has to be a validstereotype -
Add stereotypes as described in the configuration section.
-
Edit/create a new page that has children and select a stereotype from the dropdown labeled “Stereotype”. Child pages added to this page will be created with their attributes set by default to the fields you configured.
-
…
-
Profit!
- Cristi Duma (@cristi_duma)
- Istvan Hoka (@ihoka)