{% extends "base.html" %} {# ================================================================================ Site Home Page Template (Kida-Native) ================================================================================ Opinionated marketing landing for the site root. Zero-config: when frontmatter omits features/CTAs, the template fills in a polished splash from site.title and site.description — distinct from the generic section index (gallery) layout. 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 ================================================================================ #} {# ============================================================================= 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 %} {{ t('home.read_more', default='Read more') }} {{ icon('arrow-right', size=14, css_class='nav-arrow') }}
{% 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 ?? t('home.learn_more', default='Learn more') %} {{ link_text }} {{ icon('arrow-right', size=14, css_class='nav-arrow') }} {% end %}
{% end %} {# ============================================================================= MAIN TEMPLATE ============================================================================= #} {% block content %} {% let page_title = page?.title ?? site.title ?? 'Home' %} {% let page_desc = params?.description ?? site.description ?? '' %} {% let _main_nav = get_menu_lang('main', _current_lang) %} {% let _first_section = _main_nav[0] if _main_nav | length > 0 else none %} {% let _default_features = [ {'icon': 'star', 'title': t('home.feature_speed_title', default='Lightning fast'), 'description': t('home.feature_speed_desc', default='Static HTML, zero runtime overhead, and builds that finish in seconds.')}, {'icon': 'palette', 'title': t('home.feature_theme_title', default='Beautiful by default'), 'description': t('home.feature_theme_desc', default='Named palettes, view transitions, and a polished theme with no configuration required.')}, {'icon': 'puzzle-piece', 'title': t('home.feature_zero_dep_title', default='Zero dependencies'), 'description': t('home.feature_zero_dep_desc', default='No npm, no CDN — self-hosted assets and dependency-free enhancements.')}, {'icon': 'code', 'title': t('home.feature_python_title', default='Python native'), 'description': t('home.feature_python_desc', default='Content, templates, and tooling written in pure Python for modern free-threaded runtimes.')} ] %} {% let _default_ctas = [ {'text': t('home.cta_explore', default='Explore'), 'href': (_first_section?.href ?? '/docs/'), 'style': 'primary'}, {'text': t('home.cta_search', default='Search'), 'href': '/search/', 'style': 'secondary'} ] %} {% let _default_quick_links = [] %} {% for item in _main_nav | take(6) %} {% set _ = _default_quick_links.append({'title': item?.name ?? 'Section', 'href': item?.href ?? '#', 'icon': 'folder', 'description': ''}) %} {% end %} {% let _has_custom_landing = (params?.features ?? none) is not none or (params?.cta_buttons ?? none) is not none or (params?.quick_links ?? none) is not none or (params?.stats ?? none) is not none or (params?.blob_background ?? none) is not none or (content and content.strip()) %} {% let features = params?.features ?? (_default_features if not _has_custom_landing else []) %} {% let cta_buttons = params?.cta_buttons ?? (_default_ctas if not _has_custom_landing else []) %} {% let quick_links = params?.quick_links ?? (_default_quick_links if not _has_custom_landing and (_default_quick_links | length > 0) else []) %} {% let stats = params?.stats ?? [] %} {% let blob_background = params?.blob_background ?? (not _has_custom_landing) %} {% let show_recent = params?.show_recent_posts ?? true %} {% let blog_section_name = params?.blog_section ?? 'blog' %}
{# Hero Section #} {% let hero_classes = ['hero', 'hero--large', 'hero--splash'] %} {% if blob_background %}{% set _ = hero_classes.append('hero--blob-background') %}{% end %}
{% if blob_background %} {% end %}
{% if not _has_custom_landing %}

{{ t('home.eyebrow', default='Welcome') }}

{% 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 ?? '') %} {% let blog_section = get_section(blog_section_name) %} {% let recent = [] %} {% if blog_section %} {% let recent = (blog_section.pages ?? []) |> selectattr('date') |> sort(attribute='date', reverse=true) |> take(3) %} {% end %} {% if recent | length > 0 %}

{{ t('home.recent_posts', default='Recent Posts') }}

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