{# Recent Posts Section - displays latest posts from any collection Rendered by homepage-builder when recent-posts section is configured Supports type-aware rendering for likes, bookmarks, reposts, replies, photos #} {% set sectionConfig = section.config or {} %} {% set maxItems = sectionConfig.maxItems or 5 %} {% set showSummary = sectionConfig.showSummary if sectionConfig.showSummary is defined else true %} {% set excludeTypes = sectionConfig.excludeTypes or [] %} {% set recentPosts = collections.posts | excludePostTypes(excludeTypes) | head(maxItems) %} {% if recentPosts and recentPosts.length %}

{{ sectionConfig.title or "Recent Posts" }}

{% for post in recentPosts %} {# Detect post type from frontmatter properties #} {% set likedUrl = post.data.likeOf or post.data.like_of %} {% set bookmarkedUrl = post.data.bookmarkOf or post.data.bookmark_of %} {% set repostedUrl = post.data.repostOf or post.data.repost_of %} {% set replyToUrl = post.data.inReplyTo or post.data.in_reply_to %} {% set hasPhotos = post.data.photo and post.data.photo.length %} {# Determine border color by post type #} {% set borderClass = "" %} {% if likedUrl %} {% set borderClass = "border-l-[3px] border-l-red-400 dark:border-l-red-500" %} {% elif bookmarkedUrl %} {% set borderClass = "border-l-[3px] border-l-amber-400 dark:border-l-amber-500" %} {% elif repostedUrl %} {% set borderClass = "border-l-[3px] border-l-green-400 dark:border-l-green-500" %} {% elif replyToUrl %} {% set borderClass = "border-l-[3px] border-l-sky-400 dark:border-l-sky-500" %} {% elif hasPhotos %} {% set borderClass = "border-l-[3px] border-l-purple-400 dark:border-l-purple-500" %} {% else %} {% set borderClass = "border-l-[3px] border-l-surface-300 dark:border-l-surface-600" %} {% endif %}
{% if likedUrl %} {# ── Like card ── #}
Liked
{{ likedUrl | unfurlCard | safe }} {{ likedUrl }} {% if post.templateContent %}
{{ post.templateContent | safe }}
{% endif %} Permalink
{% elif bookmarkedUrl %} {# ── Bookmark card ── #}
Bookmarked
{% if post.data.title %}

{{ post.data.title }}

{% endif %} {{ bookmarkedUrl | unfurlCard | safe }} {{ bookmarkedUrl }} {% if post.templateContent %}
{{ post.templateContent | safe }}
{% endif %} Permalink
{% elif repostedUrl %} {# ── Repost card ── #}
Reposted
{{ repostedUrl | unfurlCard | safe }} {{ repostedUrl }} {% if post.templateContent %}
{{ post.templateContent | safe }}
{% endif %} Permalink
{% elif replyToUrl %} {# ── Reply card ── #}
In reply to
{{ replyToUrl | unfurlCard | safe }} {{ replyToUrl }} {% if post.templateContent %}
{{ post.templateContent | safe }}
{% endif %} Permalink
{% elif hasPhotos %} {# ── Photo card ── #}
Photo
{% if post.templateContent %}
{{ post.templateContent | safe }}
{% endif %} Permalink
{% elif post.data.title %} {# ── Article card ── #}

{{ post.data.title }}

{% if showSummary and post.templateContent %}

{{ post.templateContent | striptags | truncate(250) }}

{% endif %}
{% if post.data.postType %} {{ post.data.postType }} {% endif %}
{% else %} {# ── Note card ── #}
{% if post.data.postType %} {{ post.data.postType }} {% endif %}
{% if post.templateContent %}
{{ post.templateContent | safe }}
{% endif %} Permalink {% endif %}
{% endfor %}
{% if sectionConfig.showViewAll != false %} {{ sectionConfig.viewAllText or "View all posts" }} {% endif %}
{% endif %}