{% extends "base.html" %} {# ================================================================================ Blog Post Single Page Template (Kida-Native) ================================================================================ Individual blog post page optimized for reading. FEATURES: - Featured image support - Author information and bio - Reading time estimation - Social sharing buttons - Related posts section - Comments integration point - Table of contents sidebar KIDA FEATURES USED: - {% let %} for template-scoped variables - Optional chaining (?.) for null-safe access - Null coalescing (??) for smart defaults - {% def %} for reusable components - {% match %} for conditional rendering NOTE: Uses page.word_count and page.reading_time computed properties instead of filters for better performance (cached on first access). USAGE: Set `type: blog` in frontmatter or use cascade from section ================================================================================ #} {% from 'partials/navigation-components.html' import breadcrumbs, page_navigation %} {% from 'partials/components/tags.html' import tag_list %} {# ============================================================================= RELATED POST CARD COMPONENT - uses PostView for normalized access ============================================================================= #} {% def related_card(post) %} {% let p = post | post_view %}
{% if p.image %}
{{ p.title }}
{% end %}

{{ p.title }}

{% if p.description %}

{{ p.description | truncate(120) }}

{% end %} {% if p.date %} {% end %}
{% end %} {# ============================================================================= MAIN TEMPLATE ============================================================================= #} {% block content %} {# Template-scoped variables with null-safe access #} {% let page_title = page?.title ?? 'Blog Post' %} {% let page_date = page?.date %} {% let page_word_count = page?.word_count ?? 0 %} {% let page_read_time = page?.reading_time ?? 0 %} {% let page_tags = page?.tags ?? [] %} {% let page_href = page?.href ?? '' %} {% let theme_features = theme?.features ?? [] %} {# Params with null-safe access #} {% let post_image = params?.image ?? params?.cover ?? '' %} {% let post_desc = params?.description ?? '' %} {% let post_author = params?.author ?? '' %} {% let post_author_avatar = params?.author_avatar ?? '' %} {% let post_author_title = params?.author_title ?? '' %} {% let post_author_bio = params?.author_bio ?? '' %} {% let post_author_links = params?.author_links ?? [] %} {% let post_updated = params?.updated %} {% let post_views = params?.views %} {% let css_class = params?.css_class ?? '' %} {% let show_newsletter = params?.show_newsletter ?? false %} {% let show_comments = params?.comments ?? true %}
{# Action Bar: Breadcrumbs + Share #} {% include 'partials/action-bar.html' %}
{# Featured Image #} {% if post_image %}
{{ page_title }}
{% end %}

{{ page_title }}

{% if post_desc %}

{{ post_desc }}

{% end %} {# Post Metadata #} {# Tags #} {% if page_tags | length > 0 %} {% end %}
{# Main Post Content #}
{{ content | safe }}
{# Post Footer #}
{# Updated Date #} {% if post_updated and post_updated != page_date %}

Last updated: {{ post_updated | dateformat('%B %d, %Y') }}

{% end %} {# Author Bio #} {% with post_author, post_author_bio as author, bio %} {% if 'content.author' in theme_features %}
{% if post_author_avatar %} {{ author }} {% end %}

About {{ author }}

{% if post_author_title %}

{{ post_author_title }}

{% end %}

{{ bio }}

{% if post_author_links | length > 0 %} {% end %}
{% end %} {% end %} {# Social Sharing #}
{# Right Sidebar: TOC #} {% if toc %} {% end %}
{# Page Navigation (Prev/Next Posts) #} {{ page_navigation(page) }} {# Related Posts #} {% let related_posts = page?.related_posts |> take(3) ?? [] %} {% if related_posts | length > 0 %} {% end %} {# Comments Section (Integration Point) #} {% if show_comments %}

{{ t('blog.comments', default='Comments') }}

{{ t('blog.comments_placeholder', default='Comments are loaded dynamically. Configure your comments system in the theme.') }}

{% end %} {% end %}