{# ================================================================================ Article Card Component (Kida-Native) ================================================================================ Rich article preview card with metadata, tags, and optional image. Usage: {{ article_card(post, show_excerpt=true, show_image=false) }} ================================================================================ #} {% from 'partials/components/tags.html' import tag_list %} {# ============================================================================= ARTICLE CARD COMPONENT Displays a rich card preview of an article with metadata, tags, and image. ============================================================================= #} {% def article_card(article, show_excerpt=true, show_image=false) %} {% let article_meta = article?.metadata ?? {} %} {% let article_params = article_meta?.params ?? article?.params ?? {} %} {% let article_tags = article?.tags ?? [] %} {% let article_content = article?.content ?? '' %} {% let article_date = article?.date %} {% let article_image = article_meta?.image ?? '' %} {% let article_desc = article_meta?.description ?? '' %} {% let author_slug = article_params?.author ?? article_meta?.author ?? '' %} {% let authors_registry = site?.data?.authors ?? {} %} {% let author_data = authors_registry.get(author_slug, {}) if author_slug else {} %} {% let article_author = author_data?.name ?? article_meta?.author ?? article_params?.author ?? '' %} {% let is_featured = article is featured %} {% let theme_features = theme?.features ?? [] %}
{% if show_image and article_image %} {{ article_image | image_alt }} {% end %}
{# Badges #}
{% if is_featured %} ⭐ Featured {% end %} {% if article | has_tag('new') %} New {% end %}

{{ article.title }}

{% if article_date %} {% end %} {% if article_author and 'content.author' in theme_features %} {{ article_author }} {% end %} {% if article?.reading_time and 'content.reading_time' in theme_features %} {{ article.reading_time }} min read {% end %}
{% if show_excerpt and 'content.excerpts' in theme_features %}

{% if article_desc %} {{ article_desc }} {% elif article_content %} {{ article_content | strip_html | excerpt(150) }} {% end %}

{% end %} {% if article_tags | length > 0 %}
{{ tag_list(article_tags, small=true) }}
{% end %}
{% end %}