{{#checkIfAny @config.custom.featured @config.custom.authors @config.custom.tags @config.custom.newsletter @config.custom.socialButtons @config.custom.copyright}}
   <div class="right-bar">
      <div class="right-bar__inner">
         <div class="sidebar">
            {{#if @config.custom.featured}}
               {{#if featuredPosts}}
                  <section class="box featured">
                     <h3 class="box__title">{{ translate 'partials.sidebar.featured' }}</h3>
                     <ul class="featured__container">
                        {{#each featuredPosts}}
                           {{#checkIf @index '<' @config.custom.featuredAmount}}
                              <li class="featured__item">
                                 {{#if @config.custom.featuredImage}}
                                    {{#featuredImage}}
                                       {{#if url}}                               
                                          <a href="{{../url}}" class="featured__image">
                                             <img 
                                                {{#if @config.site.responsiveImages}}
                                                   src="{{urlXs}}"
                                                {{else}}
                                                   src="{{url}}"
                                                {{/if}}
                                                {{ lazyload "lazy" }} 
                                                alt="{{alt}}" 
                                                height="{{height}}" 
                                                width="{{height}}">
                                          </a>                               
                                       {{/if}}
                                    {{/featuredImage}}
                                 {{/if}}
                                 <div>
                                    <a href="{{url}}" class="featured__title">{{title}}</a>
                                    {{#if @config.custom.featuredDate}}
                                       <time class="featured__meta" 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>
                              </li>
                           {{/checkIf}}
                        {{/each}}
                     </ul>
                  </section>
               {{/if}}
            {{/if}}

            {{#if @config.custom.authors}}
               <section class="box authors">
                  <h3 class="box__title">{{ translate 'partials.sidebar.authors' }}</h3>
                  <ul class="authors__cotainer">
                     {{#each authors}}
                        {{#checkIf @index '<' @config.custom.authorsAmount}}
                           <li class="authors__item">
                              {{#if @config.custom.authorsAvatar}}
                                 {{#if avatar}}
                                    <a href="{{url}}" class="authors__image">                            
                                       <img 
                                          src="{{avatarImage.url}}" 
                                          {{ lazyload "lazy" }} 
                                          alt="{{avatarImage.alt}}" 
                                          height="{{avatarImage.height}}" 
                                          width="{{avatarImage.width}}" 
                                          class="authors__img">                           
                                    </a>
                                 {{/if}}
                              {{/if}}
                              <div>
                                 <a href="{{url}}" class="authors__title">{{name}}</a>
                                 {{#if @config.custom.authorsPostCount}}
                                    <span class="authors__meta">{{ translate 'partials.sidebar.authorsPost' }} {{postsNumber}}</span>
                                 {{/if}}
                              </div>
                           </li>
                        {{/checkIf}}
                     {{/each}}
                  </ul>
               </section>
            {{/if}}

            {{#if @config.custom.tags}}
               {{#if tags}}
                  <section class="box tags">
                     <h3 class="box__title">{{ translate 'partials.sidebar.tags' }}</h3>
                     <ul class="tags__list">
                        {{#each tags}}
                           {{#checkIf @index '<' @config.custom.tagsAmount}}
                              <li class="tags__item">
                                 <a href="{{url}}" class="btn btn--gray">{{name}}
                                    {{#if @config.custom.tagsPostCount}}
                                       <sup>({{postsNumber}})</sup>
                                    {{/if}}
                                 </a>
                              </li>
                           {{/checkIf}}
                        {{/each}}
                     </ul>
                  </section>
               {{/if}}
            {{/if}}


            {{#if @config.custom.newsletter}}
               <section class="box newsletter">
                  <h3 class="box__title">{{ translate 'partials.sidebar.newsletter' }}</h3>
                  <p class="newsletter__desc">{{ translate 'partials.sidebar.newsletterDesc' }}</p>
                  {{{@config.custom.newsletterFormCode}}}
               </section>
            {{/if}}
         
            {{#if @config.custom.socialButtons}}
               <div class="box follow">
                  {{#if @config.custom.socialFacebook}}
                     <a
                        href="{{@config.custom.socialFacebook}}"
                        class="tltp tltp--top"
                        aria-label="Facebook">
                        <svg>
                           <use xlink:href="{{@website.assetsUrl}}/svg/svg-map.svg#facebook"/>
                        </svg>
                        <span>Facebook</span>
                     </a>
                  {{/if}}
                  {{#if @config.custom.socialTwitter}}
                     <a 
                        href="{{@config.custom.socialTwitter}}" 
                        class="tltp tltp--top" 
                        aria-label="Twitter">
                        <svg>
                           <use xlink:href="{{@website.assetsUrl}}/svg/svg-map.svg#twitter"/>
                        </svg>
                        <span>Twitter</span>
                     </a>
                  {{/if}}
                  {{#if @config.custom.socialInstagram}}
                     <a
                        href="{{@config.custom.socialInstagram}}"
                        class="tltp tltp--top"
                        aria-label="Instagram">
                        <svg>
                           <use xlink:href="{{@website.assetsUrl}}/svg/svg-map.svg#instagram"/>
                        </svg>
                        <span>Instagram</span>
                     </a>
                  {{/if}}
                  {{#if @config.custom.socialLinkedin}}
                     <a
                        href="{{@config.custom.socialLinkedin}}"
                        class="tltp tltp--top"
                        aria-label="LinkedIn">
                        <svg>
                           <use xlink:href="{{@website.assetsUrl}}/svg/svg-map.svg#linkedin"/>
                        </svg>
                        <span>LinkedIn</span>
                     </a>
                  {{/if}}
                  {{#if @config.custom.socialVimeo}}
                     <a 
                        href="{{@config.custom.socialVimeo}}" 
                        class="tltp tltp--top" 
                        aria-label="Vimeo">
                        <svg>
                           <use xlink:href="{{@website.assetsUrl}}/svg/svg-map.svg#vimeo"/>
                        </svg>
                        <span>Vimeo</span>
                     </a>
                  {{/if}}
                  {{#if @config.custom.socialPinterest}}
                     <a
                        href="{{@config.custom.socialPinterest}}"
                        class="tltp tltp--top"
                        aria-label="Pinterest">
                        <svg>
                           <use xlink:href="{{@website.assetsUrl}}/svg/svg-map.svg#pinterest"/>
                        </svg>
                        <span>Pinterest</span>
                     </a>
                  {{/if}}
                  {{#if @config.custom.socialYoutube}}
                     <a 
                        href="{{@config.custom.socialYoutube}}" 
                        class="tltp tltp--top" 
                        aria-label="Youtube">
                        <svg>
                           <use xlink:href="{{@website.assetsUrl}}/svg/svg-map.svg#youtube"/>
                        </svg>
                        <span>Youtube</span>
                     </a>
                     {{/if}}
               </div>
            {{/if}}

            {{#if @config.custom.copyright}}
               <div class="box copyright">
                  {{@config.custom.copyrightText}}
               </div>
            {{/if}}

         </div>
      </div>
   </div>
{{/checkIfAny}}