{% extends "base.html" %} {# ================================================================================ Site Home Page Template (Kida-Native) ================================================================================ Landing page for the site with hero, features, stats, and recent posts. KIDA FEATURES USED: - {% let %} for template-scoped variables - Optional chaining (?.) for null-safe access - Null coalescing (??) for smart defaults - Pipeline operator (|>) for filter chains - {% def %} for reusable components - {% cache %} for recent posts computation USAGE: Auto-selected for site home page (index.html) ================================================================================ #} {# ============================================================================= POST CARD COMPONENT ============================================================================= #} {% def post_card(post) %} {% let post_meta = post?.metadata ?? {} %} {% let post_image = post_meta?.image ?? post_meta?.cover ?? '' %} {% let post_title = post?.title ?? 'Untitled' %} {% let post_href = post?.href ?? '#' %} {% let post_date = post?.date %} {% let post_desc = post_meta?.description ?? post?.excerpt ?? '' %}
{% if post_image %}
{{ post_title }}
{% end %}

{{ post_title }}

{% if post_date %} {% end %} {% if post_desc %}

{{ post_desc | truncate(150) }}

{% end %} Read more →
{% end %} {# ============================================================================= FEATURE CARD COMPONENT ============================================================================= #} {% def feature_card(feature) %} {% let feat_icon = feature?.icon ?? '' %} {% let feat_title = feature?.title ?? '' %} {% let feat_desc = feature?.description ?? '' %} {% let feat_link = feature?.link %}
{% if feat_icon %} {% end %}

{{ feat_title }}

{{ feat_desc }}

{% if feat_link %} {% let link_url = feat_link?.href ?? feat_link?.url ?? '#' %} {% let link_text = feat_link?.text ?? 'Learn more' %} {{ link_text }} {% end %}
{% end %} {# ============================================================================= MAIN TEMPLATE ============================================================================= #} {% block content %} {# Template-scoped variables with null-safe access #} {% let page_title = page?.title ?? config?.title ?? 'Home' %} {% let page_desc = params?.description ?? '' %} {% let blob_background = params?.blob_background ?? false %} {% let cta_buttons = params?.cta_buttons ?? [] %} {% let features = params?.features ?? [] %} {% let quick_links = params?.quick_links ?? [] %} {% let stats = params?.stats ?? [] %} {% let show_recent = params?.show_recent_posts ?? true %} {% let blog_section_name = params?.blog_section ?? 'blog' %}
{# Hero Section #} {% let hero_classes = ['hero', 'hero--large'] %} {% if blob_background %}{% set _ = hero_classes.append('hero--blob-background') %}{% end %}
{% if blob_background %} {% end %}

{{ page_title }}

{% if page_desc %}

{{ page_desc }}

{% end %} {% if cta_buttons | length > 0 %}
{% for button in cta_buttons %} {% let btn_url = button?.href ?? button?.url ?? '#' %} {% let btn_text = button?.text ?? 'Button' %} {% let btn_style = button?.style ?? 'primary' %} {{ btn_text }} {% end %}
{% end %}
{# Feature Highlights #} {% if features | length > 0 %}
{% for feature in features %} {{ feature_card(feature) }} {% end %}
{% end %} {# Main Content #} {% if content and content.strip() %}
{{ content | safe }}
{% end %} {# Quick Links Section #} {% if quick_links | length > 0 %} {% end %} {# Statistics/Metrics Section #} {% if stats | length > 0 %}
{% for stat in stats %}
{{ stat?.value ?? '0' }}
{{ stat?.label ?? '' }}
{% end %}
{% end %} {# Recent Posts Section - cached for performance #} {% if show_recent %} {% cache 'home-recent-posts-' ~ (site.nav_version ?? '') %} {# Find blog section - O(1) dict lookup via get_section() #} {% let blog_section = get_section(blog_section_name) %} {# Get recent posts from section pages #} {% let recent = [] %} {% if blog_section %} {% let recent = (blog_section.pages ?? []) |> selectattr('date') |> sort(attribute='date', reverse=true) |> take(3) %} {% end %} {% if recent | length > 0 %}

Recent Posts

{% for post in recent %} {{ post_card(post) }} {% end %}
{% end %} {% end %} {% end %}
{% end %}