You can now use conditional logic and repeating sections in your Amplify post body templates, powered by the same Mustache template engine available in layouts. Your social media messages automatically adjust based on the content you’re sharing.
What you can do with this:
- One template for every story type. An opinion piece leads with the columnist’s name. A breaking news post goes straight to the headline. A feature story pulls the description. You stop duplicating templates for every variation.
- Auto-generate hashtags from tags. Loop through article tags and build the hashtag list automatically. No more copying tags by hand across dozens of daily posts.
Here’s how you can get started:
- Add conditional text. Show or hide portions of your post based on article properties. Use
{{#choose}}and{{#when}}to customize messages by section, author, visibility, or any article field. An opinion piece gets a different treatment than a breaking news story, all from the same template. - Iterate over arrays. Loop through authors, sections, or tags with
{{#each}}. List multiple authors in a byline, generate hashtags from all article tags, or build structured post copy from any repeating field. - Combine with Custom Fields. Use any metadata extracted through Custom Fields in your conditions and templates. Personalize posts by content tier, market, brand, or any custom taxonomy from your CMS.
- No setup required. Start using the advanced syntax directly in your post templates. It works with your existing Amplify workflows, OpenGraph metadata, URL parameters, and UTM tracking.
Example: Customize post copy based on section, including author attribution and description only for opinion articles:
{{#choose}}
{{#when "sections[0] eq 'OPINION'"}}
{{sections.0}} by {{authors.0}}
{{og:description}}
{{/when}}
{{#otherwise}}
{{og:description}}
{{/otherwise}}
{{/choose}}
Find out more about Amplify Layouts and Custom Fields.