{# ================================================================================ Post Card Component (Shared) ================================================================================ Single shared component for blog post cards with variants: featured, default, compact. Uses PostView for normalized access. All links use p.href (includes baseurl for GitHub Pages / subpath deployment). Usage: {{ post_card(post, variant='default', show_image=true, show_excerpt=true) }} Variants: - featured: larger card, gradient-border-strong fluid-bg, full date format - default: standard card, gradient-border fluid-combined, time_ago - compact: minimal (title, date, optional excerpt) ================================================================================ #} {% from 'partials/components/tags.html' import tag_list %} {% def post_card(post, variant='default', show_image=true, show_excerpt=true) %} {% let p = post | post_view %} {% if p %} {% let theme_features = theme?.features ?? [] %} {% match variant %} {% case 'featured' %}
{% if show_image and p.image %}
{{ p.title }}
{% end %}
{% if (p.author and 'content.author' in theme_features) or p.date or (p.reading_time > 0 and 'content.reading_time' in theme_features) %}
{% if p.author and 'content.author' in theme_features %} {% if p.author_avatar %} {{ p.author }} {% end %} {{ p.author }} {% end %} {% if p.date %} {% end %} {% if p.reading_time > 0 and 'content.reading_time' in theme_features %} {{ p.reading_time }} min read {% end %}
{% end %}

{{ p.title }}

{% if show_excerpt and p.excerpt and 'content.excerpts' in theme_features %}
{{ p.excerpt | card_excerpt_html((p.excerpt_words ?? config.content.excerpt_words ?? 150) | coerce_int(150), p.title, p.description) | safe }}
{% end %} {% if p.tags | length > 0 %}
{{ tag_list(p.tags[:3]) }}
{% end %}
{% case 'compact' %}
{% if show_image and p.image %}
{{ p.title }}
{% end %}
{% if (p.author and 'content.author' in theme_features) or p.date %}
{% if p.author and 'content.author' in theme_features %} {% if p.author_avatar %} {{ p.author }} {% end %} {{ p.author }} {% end %} {% if p.date %} {% end %}
{% end %}

{{ p.title }}

{% if show_excerpt and p.excerpt and 'content.excerpts' in theme_features %}
{{ p.excerpt | card_excerpt_html(p.excerpt_words ?? config.content.excerpt_words ?? 150, p.title, p.description, halve_words=true) | safe }}
{% end %}
{% case _ %}
{% if show_image and p.image %}
{{ p.title }}
{% end %}
{% if (p.author and 'content.author' in theme_features) or p.date or (p.reading_time > 0 and 'content.reading_time' in theme_features) %}
{% if p.author and 'content.author' in theme_features %} {% if p.author_avatar %} {{ p.author }} {% end %} {{ p.author }} {% end %} {% if p.date %} {% end %} {% if p.reading_time > 0 and 'content.reading_time' in theme_features %} {{ p.reading_time }} min read {% end %}
{% end %}

{{ p.title }}

{% if show_excerpt and p.excerpt and 'content.excerpts' in theme_features %}
{{ p.excerpt | card_excerpt_html((p.excerpt_words ?? config.content.excerpt_words ?? 150) | coerce_int(150), p.title, p.description) | safe }}
{% end %}
{% end %} {% end %} {% end %}