{{> head}}
{{> navbar}}
<main class="page page--tag">
   {{#tag}}
      <section class="hero wrapper">
         {{#if tagViewConfig.displayDescription}} 
            {{#if description}}
               {{{description}}}
            {{/if}}  
         {{/if}} 
         <h1>
            {{name}}
            {{#if tagViewConfig.displayPostCounter}}<sup>({{postsNumber}})</sup>{{/if}}
         </h1>     
      </section>
      {{#if tagViewConfig.displayPostList}} 
         {{#checkIf @config.custom.cardsLayout '==' "compact" }}
            <section class="l-col l-col{{@config.custom.layoutTags}}">
               {{#each ../posts}}
                  <article
                     class="c-card{{#isFeatured}} c-card--compact c-card--featured{{/isFeatured}}">
                     <a href="{{url}}" class="c-card__link">
                        {{#featuredImage}}
                           {{#if url}}
                              <div class="c-card__header">
                                 <img
                                    src="{{url}}"
                                    {{#if @config.site.responsiveImages}}
                                       {{responsiveImageAttributes 'featuredImage' srcset.cards sizes.cards}}
                                    {{/if}}
                                    {{ lazyload "lazy" }}
                                    height="{{height}}"
                                    width="{{width}}"
                                    alt="{{alt}}">
                              </div>
                           {{/if}}
                        {{/featuredImage}}
                        <div class="c-card__body c-card__body--compact">
                           <div class="c-card__text c-card__text--compact">
                              <h2>
                                 {{title}}
                              </h2>
                              {{#if @config.custom.cardsDate}}
                                 <time datetime="{{date createdAt 'YYYY-MM-DDTHH:mm'}}">
                                    {{#checkIf @config.custom.formatDate '!=' 'custom'}}
                                       {{date createdAt @config.custom.formatDate}}
                                    {{else}}
                                       {{date createdAt @config.custom.formatDateCustom}}
                                    {{/checkIf}}
                                 </time>
                              {{/if}}
                           </div>
                        </div>
                     </a>
                  </article>
               {{/each}}
            </section>
         {{else}}
            <section class="l-col l-col{{@config.custom.layoutTags}}">
               {{#each ../posts}}
                  <article class="c-card{{#isFeatured}} c-card--featured{{/isFeatured}}">
                     <a href="{{url}}" class="c-card__link">
                        {{#featuredImage}}
                           {{#if url}}
                              <div class="c-card__header">
                                 <img
                                    src="{{url}}"
                                    {{#if @config.site.responsiveImages}}
                                       {{responsiveImageAttributes 'featuredImage' srcset.cards sizes.cards}}
                                    {{/if}}
                                    {{ lazyload "lazy" }}
                                    height="{{height}}"
                                    width="{{width}}"
                                    alt="{{alt}}">
                              </div>
                           {{/if}}
                        {{/featuredImage}}
                        <div class="c-card__body">
                           <div class="c-card__text">
                              <h2>
                                 {{title}}
                              </h2>
                              {{#if @config.custom.cardsDate}}
                                 <time datetime="{{date createdAt 'YYYY-MM-DDTHH:mm'}}">
                                    {{#checkIf @config.custom.formatDate '!=' 'custom'}}
                                       {{date createdAt @config.custom.formatDate}}
                                    {{else}}
                                       {{date createdAt @config.custom.formatDateCustom}}
                                    {{/checkIf}}
                                 </time>
                              {{/if}}
                           </div>
                        </div>
                     </a>
                  </article>
               {{/each}}
            </section>
         {{/checkIf}}
         {{> pagination}}
      {{/if}}
   {{/tag}}
</main>
{{> footer}}
