Proof of Concept: Include Accolade Content / Cross-Section Content Fetching
Overview
This proof of concept demonstrates how a content editor can pull content into any page, either by linking to a single item directly, or by linking to an entire section and automatically displaying every relevant content item contained within it.
Content Type Structure
#PSRR26751 Include Accolade Content (id: 2602)
This is the parent content type editors use when adding accolade content to a page. It contains a repeater element powered by:
#PSRR26751 Include Accolade - Repeater (id: 2603)
This repeater has a single element: a Section/Content Link. This one field is what drives the whole logic — depending on what the editor selects here, the Handlebars layout behaves differently:
- If a single Content item is selected (an individual accolade): the layout detects this via
contentIdreturning a value greater than0, and embeds that one accolade directly using itstext/html-livelayout. - If a Section is selected instead of an individual item:
contentIdreturns0(no content in scope), so the layout falls into a loop that usescontentInSectionto fetch every piece of content in that section matching the Accolade content type, and embeds each one in turn.
This gives editors flexibility — they can either showcase one specific accolade, or link to a whole section and have all accolades from it appear automatically, without needing to add them individually.
The Handlebars Logic
{{#with (linkTarget element="Select accolade")}}
{{#gt (contentId) 0}}
{{!-- A single accolade item was selected --}}
{{embed layout="text/html-live"}}
{{else}}
{{!-- A section was selected — loop over all accolades in the section --}}
{{#each (contentInSection contentTypeId="123")}}
{{embed layout="text/html-live"}}
{{/each}}
{{/gt}}
{{/with}}
linkTargetswitches processing context to whatever the editor selected in the Section/Content Link element.contentIdtells us whether that selection was a Content Link (> 0) or a Section Link (0).contentInSection(restricted to the Accolade content type) retrieves every matching, approved item in the selected section.- Each matched item is passed through
embedusing the sametext/html-livelayout used for single selections, so output is consistent regardless of which path is taken.
Note: only Approved (and unexpired) content is returned by contentInSection.
Examples
Individual accolade pulled into a section:
Section 282237 and
Section 282242
both demonstrate an editor selecting a single accolade Content Link, which is embedded directly.
Section selected, all accolades pulled automatically:
Section 282243
demonstrates selecting the Section Link instead, which triggers the loop and pulls in every accolade from the target section.
Centralised Accolade Hub:
Section 282241
acts as the single source of truth — all accolade content items originate here, and other sections reference this hub either individually or in bulk rather than duplicating content.
Benefit
This pattern establishes a single source of truth model: accolades are authored and approved once in the central hub section, then referenced, either individually or in full, from any number of other pages. This reduces content duplication, simplifies maintenance (update once, reflects everywhere), and gives editors a simple, flexible mechanism (one link field) to control exactly what displays. They can be duplicated as needed and will retain any selected items.