[MTE-72] Use templating function to get teaser image Created: 07/Jan/16  Updated: 15/Mar/21  Resolved: 15/Mar/21

Status: Closed
Project: Magnolia Templating Essentials
Component/s: ftl-templates
Affects Version/s: 0.9
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: Federico Grilli Assignee: Unassigned
Resolution: Obsolete Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
dependency
depends upon MAGNOLIA-6484 Provide templating function to get fi... Open
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)

 Description   

We currently use an FTL recursive function which doesn't work in all cases and probably introduces too much complexity for a simple template (see /magnolia-templating-kit/src/main/resources/mtk/templates/includes/teaserPage.ftl). Once the issue we depend upon is resolved one could do

[#-- If no overriding image has been defined, try to get the first image in the target. --]
     [#if !hideTeaserImage && !image?has_content]
        [#assign imageId = cmsfn.findFirstProperty(target, "image")]
        [#if imageId?has_content]
            [#assign image =  damfn.getRendition(imageId, "original")]
        [/#if]    
     [/#if]

Generated at Mon Feb 12 07:41:11 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.