{# Featured Posts Section - displays curated posts with `featured: true` frontmatter Rendered by homepage-builder when featured-posts section is configured Supports type-aware rendering for articles, notes, likes, bookmarks, reposts, replies, photos #} {% set sectionConfig = section.config or {} %} {% set maxItems = sectionConfig.maxItems or 6 %} {% set showSummary = sectionConfig.showSummary if sectionConfig.showSummary is defined else true %} {% if collections.featuredPosts and collections.featuredPosts.length %}

{{ sectionConfig.title or "Featured" }}

{% for post in collections.featuredPosts | head(maxItems) %} {# 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/Page 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 collections.featuredPosts.length > maxItems %}
View all {{ collections.featuredPosts.length }} featured posts →
{% endif %}
{% endif %}