As we defined in our Editor documentation for Boards about the Summary templates, Summary templates are used for different ways of showing content in different contexts. With Summary templates you can customize the layout of your page and how to display content in them by selecting different summary templates you have inside your theme.
Summary templates are meant to separate content from Block types. You can have a page list custom template which works with a summary template and once you have the summary template different blocks can work with that. You can have a page list and you have different blocks to display summary template.
Let's have a look at how Summary Templates are used in Atomik theme. When you install the Atomik theme, it also installs Summary templates. Below is a portion of XML of how you can define Summary templates when you install your theme.
<summarytemplates>
<template handle="blog_image_left" name="Blog Image Left"
icon="blank.png" package="">
<categories>
<category handle="page"/>
</categories>
<fields>
<field required="1">title</field>
<field required="1">link</field>
<field required="1">thumbnail</field>
<field required="1">date</field>
</fields>
</template>
</summarytemplates>
When this content XML is installed, it automatically creates a summary template with the handle blog_image_left
, named "Blog Image Left". This template will be available to the page
summary category, provided that page has a valid title, link, thumbnail and date.
Summary Categories
Generally, every summary template can have one or more categories. By default it has two categories in Concrete version 9.
- Page
- Calendar Event
With the Summary Category, you can define what type of Page Objects this summary template applies to. We are adding more categories under Summary templates.
Summary Fields
These are built-in fields in Concrete and these will be installed during the installation of Concrete CMS. You can find all Summary Fields installed listed here
/path/to/install_directory/concrete/config/install/base/summary.xml
<summaryfields>
<field handle="title" name="Title" package=""/>
<field handle="date" name="Date" package=""/>
<field handle="date_start" name="Start Date" package=""/>
<field handle="date_end" name="End Date" package=""/>
<field handle="link" name="Link" package=""/>
<field handle="description" name="Description" package=""/>
<field handle="thumbnail" name="Thumbnail" package=""/>
<field handle="categories" name="Categories" package=""/>
<field handle="author" name="Author" package=""/>
</summaryfields>
These fields can be used when you define your summary template. Fields can be required based on how you want to display content with this summary template on your site.
Summary Templates
Once a template has been defined in the database, it will be available for all categories of objects it is assigned to (calendar event, page, etc...). That means the same generalized template can be used to display content from page as well as a calendar event – and therefore that both calendar events and pages can be shown in boards.
Below is the example of blog_entry_card
summary template which comes with Atomik Theme.
<div class="ccm-summary-template-blog-entry-thumbnail">
<a href="<?=$link?>" class="card">
<div class="position-relative">
<div class="card-img-top ccm-summary-template-blog-entry-thumbnail-image-overlay"></div>
<img class="card-img-top" src="<?=$thumbnail->getThumbnailURL('blog_entry_thumbnail')?>">
</div>
<div class="card-body">
<h5 class="card-title"><?=$title?></h5>
<?php if ($date) { ?>
<p class="card-text text-center"><small class="text-muted"><?=date('F d, Y', (string) $date)?></small></p>
<?php } ?>
</div>
</a>
</div>
Note: If there are already existing pages (or calendar events, etc...) and the summary template gets added later. The reindex content task needs to be run, so that the content from the pages (or calendar events, etc...) for the different summary templates gets newly added to the database (Table PageSummaryTemplates
).