Uploaded image for project: 'Magnolia Templating Essentials'
  1. Magnolia Templating Essentials
  2. MTE-72

Use templating function to get teaser image

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Obsolete
    • Icon: Major Major
    • None
    • 0.9
    • ftl-templates
    • None

      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]
      

        Acceptance criteria

              Unassigned Unassigned
              fgrilli Federico Grilli
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Task DoD