Creating templates for other view modes
You can create a template for each of the "non full" View mode. These are typically used for lists where the content isn't viewed on its own page in full. For more information on View modes see Understanding view modes.
Create a 'non full' content template
There are three steps to creating a content template.
For the purpose of an example, the following steps are for creating Content type templates as this is the most common use case, but the same process applies for other content entity types like Taxonomy vocabularies.
Step 1 - Choose an entity bundle view mode to template
The first step is to select what you're going to make a template for. For example, the Article teaser content type.
- Navigate to DX8 > Templates > Content templates
- For Content types and this example click on Content type
- Click on one of the Accordions to open the list of template options for that Content type
- Locate the teaser view mode template.
- Click Create in the Operations column.
Step 2 - Save your template
The second step is to save your template. Don't worry about its layout yet, this is covered later.
- The name for your template is set by the name of the View mode. You cannot change this
- At this point you haven't created a layout for your template but click Save and continue to save your progress and allow you to preview your template.
Step 3 - Layout and preview your template
Layout your template using the Layout builder. For more information, see Using the layout builder.
To begin with, add dummy content directly into your template. This is so you'll be able to preview what your template will look like before connecting it to the live data from your Content type fields (This is done later).
Previewing your template
The easiest way to preview your template is to create a test page (node) that uses it and click Preview. You'll notice that the preview is of the Full content view mode. To preview the Teaser view mode, select Teaser in the drop-down at the top of the preview.
Step 4 - Connect your template fields to your content type fields
Once you've created your template layout, you can connect it to fields within your content type so that it uses real content provided within your Content type rather than the dummy content you added when building your layout.
The process of linking your layout to fields is the same when creating any type of template using DX8. For that reason, it's been described on a separate page, see Connecting your templates to fields.