18F/18f.gsa.gov

View on GitHub
_includes/related-posts.html

Summary

Maintainability
Test Coverage
<section class="grid-container usa-section posts_feature">
  {% if site.related_posts.size > 0 %}
    <h2>Related posts</h2>
  {% endif %}
  <ul class="grid-row grid-gap">
  {% for post in page.related_posts %}
    <li class="tablet:grid-col-4">
      <article>
        <p class="post-date">{{ post.date | date: "%B %-d, %Y" }}</p>
        <h3 class="posts_feature-heading">
          <a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}
          {% if post.series %}
            (Series: {{ post.series }})
          {% endif %}
          </a>
        </h3>
        <p>{{ post.excerpt }}</p>
        <p>
          <a class="link-arrow-right post-link-continue_reading" href="{{ post.url | prepend: site.baseurl }}">
            Continue reading
            <span class="usa-sr-only">about {{ post.title }}</span>
            {% include svg/icons/arrow-right.svg %}
          </a>
        </p>
        <span class="post-tags" itemprop="keywords">
          {% for tag in post.tags %}
            <a class="usa-label" href="{{ site.baseurl }}/{{ site.tag_dir }}/{{ tag | slugify }}/">{{ tag }}
            </a>
          {% endfor %}
        </span>
      </article>
    </li>
    {% if forloop.index > 2 %}
      {% break %}
    {% endif %}
    {% endfor %}
  </ul>
</section>