Download
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

Questions about {{#each}} with posts & featuredPosts

#3248
Avatar photoBob

You can do this by checking the order of the posts and applying the correct image size:

{{#if featuredPosts}}
    <ol class="container">
        {{#each featuredPosts}}
            <li>
                {{#featuredImage}}
                    {{#if url}}
                        <img
                            {{#checkIf @index '==' 0}}
                               src="{{urlLg}}"
                            {{else}}
                               src="{{urlXs}}"
                            {{/checkIf}}
                            {{#if @config.site.responsiveImages}}
                               {{responsiveImageAttributes 'featuredImage' srcset.listing sizes.listing}}
                            {{/if}}
                            {{ lazyload "lazy" }}
                            height="{{height}}"
                            width="{{width}}"
                            alt="{{alt}}">
                    {{/if}}
                {{/featuredImage}}
            </li>
        {{/each}}
    </ol>
{{/if}}

More about the image settings:  https://getpublii.com/dev/how-images-work-in-publii/#advanced