{% doc %} Article card used on the blog index and on related articles. @param {article} article - Article to render @param {boolean} [show_excerpt] - Shows the excerpt and read-more label @param {boolean} [show_author] - Shows the author next to the date @param {boolean} [eager] - Loads the image immediately @param {string} [heading_tag] - Heading element, h2 or h3 @example {% render 'blog-card', article: article, show_excerpt: true, show_author: true %} {% enddoc %} {% liquid if heading_tag == blank assign heading_tag = 'h2' endif if eager assign image_loading = 'eager' else assign image_loading = 'lazy' endif assign image_alt = '' if article.image != blank if article.image.alt != blank assign image_alt = article.image.alt else assign image_alt = article.title endif endif assign excerpt = article.excerpt_or_content | strip_html | truncate: 180 assign published = article.published_at | date: '%B %d, %Y' %}
{% if article.image != blank %} {{ article.image | image_url: width: 1200 | image_tag: loading: image_loading, widths: '414, 600, 828, 1200', sizes: '(max-width: 767px) 100vw, (max-width: 1024px) 50vw, 33vw', alt: image_alt, class: 'aspect-[3/2] w-full object-cover transition duration-500 ease-out group-hover:scale-105' }} {% else %}
{% endif %}
<{{ heading_tag }} id="Article-{{ article.id }}" class="m-0 text-[22px] font-light leading-[1.27] tracking-[0.6px] text-[#1a1b18]" > {{- article.title | escape -}}

{% if show_author and article.author != blank %} {{ article.author | escape }} {% endif %}

{% if show_excerpt and excerpt != blank %}

{{ excerpt | escape }}

{{- 'blog.read_more' | t -}} {% endif %}