Adding a Template to Display an Event
You should have a web content template for each new type of structure you add, as they define how to order and arrange each field in the structure.
Here, you’ll use HTML and FreeMarker tags to format the fields for an Event article.
Start Creating the Template
-
Log in as Preston Palmer, your public site administrator (if you haven’t already).
-
Navigate to the Site Menu () → Content & Data → Web Content.
-
Click the Structures tab to get to the structures you created previously.
-
Select Manage Templates in the Event structure’s Actions menu ().
-
Click Add () to create a new template.
The new template is associated automatically with the Event structure because you chose to manage templates for it.
-
At the top of the page, enter
Simple Event Format
as the title. -
In the Properties menu (on the right side of the screen), enter this into the Description field:
A generic template to display an event.
Configure the Template’s Fields
Now, arrange the order and format to display field data for Event articles.
-
Click Elements () to reopen the Elements menu.
-
Click into the body of the template and delete the placeholder text.
-
In the Elements menu, scroll down to the fields under Journal and click Title.
This automatically adds code that uses the title value.
-
Surround the code with H1 heading HTML tags (
<h1>
), like this:<h1>${.vars["reserved-article-title"].data}</h1>
Event articles published with this template start with the title as an H1 header.
-
In the Elements menu, scroll up to Fields and click Summary.
This adds a reference to the Summary contents, as long as it exists. It uses the FreeMarker
<#if>
tag to do this. -
Surround the Summary text reference with H3 heading HTML tags (
<h3>
). -
Press Enter twice to add two new lines and, from the list of fields in the Elements menu, click Banner Image.
-
Press Enter twice to add two more new lines, and add a separator line with an HTML tag (
<hr>
). -
Press Enter twice to add two more new lines and, from the list of fields in the Elements menu, click Body.
Now your Event template is complete, and you can display an Event article with a presentable format. You’ll see this later when you display an article on a page.
Next: create a template for the other structure you created, FAQs.