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

Use templating function to get teaser image

    XMLWordPrintable

Details

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

    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]
      

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Task DoD