<!DOCTYPE html>
<html lang="en">
  {% include appscms/head/bloghead.html %}
  <style>
    .authors-heading {
      font-size: 50px;
      font-weight: 900;
    }

    .authors-info {
      padding: 32px;
      display: flex;
      flex-direction: column;
      justify-content: center;
      text-align: center;
      height: 100%;
      width: 100%;
      background: white;
      box-shadow: 2px 4px 8px #d0cdcd;
      border-radius: 15px;
      margin-bottom: 100px;
    }

    .authors-info .authors-image img {
      display: inline-block;
      width: 150px;
      height: 150px;
      padding: 8px;
      border-radius: 50%;
      object-fit: cover;
      user-select: none;
    }

    .authors-info .authors-name {
      margin: 1rem;
      font-size: 23px;
      color: #000;
      font-weight: 600;
    }

    .authors-info .authors-bio {
      color: #121315;
      font-size: 14px;
    }

    .authors-posts-count {
      font-size: 16px;
      font-weight: 400;
      color: #000 !important;
      text-decoration: underline !important;
    }
  </style>

  <body>
    {%- include appscms/navbars/navbar.html -%} {%- include
    appscms/navbars/toolbar.html -%}
    <section class="authors-list" style="margin-top: 50px">
      <div class="container">
        <div class="row">
          <div class="col-md-12">
            <h1 class="mb-5 text-center authors-heading">Our Authors</h1>
            <div class="row">
              {% assign authorsList = "" | split: "" %} {% assign folder_path =
              '' %} {% for file in site.pages %} {% if file.path contains
              folder_path %} {% assign pageData = file | parse_yaml %} {% assign
              lang = pageData.lang %} {% assign foldername = pageData.folderName
              %} {% assign filename = pageData.fileName %} {% assign permalink =
              pageData.permalink %} {% assign json_data =
              site.data[foldername][lang][filename] | json %} {% for author in
              json_data.author %} {%- assign splitAuthor = author | split: " "
              -%} {% assign featureAuthorFirst = splitAuthor.first | downcase %}
              {%- assign collectionData = [featureAuthorFirst] -%} {%- for item
              in collectionData -%} {%- if forloop.index == 1 -%} {%- assign
              seoTeamAuthorName = item -%} {%- assign authorsList = authorsList
              | push: seoTeamAuthorName -%} {%- endif -%} {%- endfor -%} {%
              endfor %} {% endif %} {%- endfor -%} {% assign contributorAuthors
              = "" | split: "" %} {% assign folder_path = '' %} {% for file in
              site.pages %} {% if file.path contains folder_path %} {% assign
              pageData = file | parse_yaml %} {% assign lang = pageData.lang %}
              {% assign foldername = pageData.folderName %} {% assign filename =
              pageData.fileName %} {% assign permalink = pageData.permalink %}
              {% assign json_data = site.data[foldername][lang][filename] | json
              %} {% for contributor in json_data.contributors %} {%- assign
              splitAuthor = contributor.name | split: " " -%} {% assign
              contributorAuthor = splitAuthor.first | downcase %} {%- assign
              collectionData = [contributorAuthor] -%} {%- for item in
              collectionData -%} {%- if forloop.index == 1 -%} {%- assign
              contributorAuthor = item -%} {%- assign contributorAuthors =
              contributorAuthors | push: contributorAuthor -%} {% assign
              mergedArray = authorsList | concat: contributorAuthors %} {% endif
              %} {%- endfor -%} {% endfor %} {% endif %} {% endfor %} {% assign
              postAuthors = "" | split: "" %} {%- for post in site.posts -%} {%-
              if post.author != "" -%} {%- assign postAuthors = postAuthors |
              push: post.author -%} {% assign final_array = mergedArray |
              concat: postAuthors %} {%- endif -%} {%- endfor -%} {% assign
              uniqueArray = final_array | uniq %} {% for author in uniqueArray
              %} {%- assign splitAuthor = author | split: " " -%} {%- assign
              authorFirst = splitAuthor.first | downcase -%} {%- assign
              collectionData = [authorFirst] -%} {%- for item in collectionData
              -%} {%- if forloop.index == 1 -%} {%- assign authorName = item -%}
              {%- elsif forloop.index == 2 -%} {%- assign image = item -%} {%-
              elsif forloop.index == 3 -%} {%- assign bio = item -%} {%- endif
              -%} {%- endfor -%}
              <div class="col-md-4 mb-5">
                <div class="authors-info">
                  <a
                    class="authors-image"
                    href="/authors/{{authorName | downcase | replace: ' ', '-' }}"
                  >
                    <img
                      loading="lazy"
                      src="{{image}}"
                      alt="{{ authorName }}"
                    />
                  </a>
                  <a
                    class="authors-name"
                    href="/authors/{{authorName | downcase | replace: ' ', '-' }}"
                    >{{authorName | capitalize }}</a
                  >

                  {% assign authorPosts = site.posts | where: 'author', author
                  %} {% assign postCount = authorPosts | size %} {% if postCount
                  > 0 %}
                  <a href="/blog/" class="authors-posts-count"
                    >{{ postCount }} Posts</a
                  >
                  {% endif %}

                  <p class="authors-bio mt-3">{{bio}}</p>
                </div>
              </div>
              {% endfor %}
            </div>
          </div>
        </div>
      </div>
      {% include section/count.html %}
    </section>
    {%- include appscms/footer/static-footer.html -%} {%- include
    appscms/scripts/script.html -%}
  </body>
</html>

<!-- author name should be same in feature json or blog posts json -->