{% extends "base.html" %} {# ================================================================================ Chronological Archive Template (Kida-Native v2) ================================================================================ Blog-style sections with dated posts in reverse chronological order. KIDA FEATURES SHOWCASED: - {% let %} multi-assignment for template-scoped variables - {% unless %} for cleaner negative conditionals - {% break %} for loop control (limit featured posts) - {% continue %} to skip items in iteration - Range expressions (1..N) for pagination display - {% match %} for pluralization and conditional dispatch - {% embed %} for card component composition - Optional chaining (?.) for null-safe access - Null coalescing (??) for smart defaults - Pipeline operator (|>) for filter chains - {% spaceless %} for clean HTML output USAGE: - Blog posts - News articles - Any time-ordered content ================================================================================ #} {% from 'partials/navigation-components.html' import breadcrumbs, section_navigation, pagination %} {% from 'partials/components/article.html' import article_card %} {# Maximum featured posts to show before breaking #} {% let MAX_FEATURED = 3 %} {% block content %} {# Template-scoped variables with multi-let #} {% let page_or_section = section ?? page, page_title = title ?? section?.title ?? 'Archive', page_desc = description ?? section?.params?.description ?? '', archive_posts = posts ?? [], archive_subsections = subsections ?? [], total_pages = total_pages ?? 1, current_page = current_page ?? 1, archive_posts_count = archive_posts | length, base_url = base_url ?? section?.href ?? '/archive/' %} {% let total_posts = total_posts ?? archive_posts_count %}
{{ breadcrumbs(page_or_section) }} {# Section navigation for section pages #} {% with section as sec %} {{ section_navigation(sec) }} {% end %}
{% if archive_posts | length > 0 %} {# ===================================================================== FEATURED POSTS - Using {% break %} to limit count ===================================================================== #} {% let featured_posts = archive_posts |> where('featured', true) |> list %} {% if featured_posts | length > 0 %} {% end %} {# ===================================================================== REGULAR POSTS - Using {% continue %} to skip drafts ===================================================================== #} {% let regular_posts = archive_posts |> where_not('featured', true) |> list %} {% if regular_posts | length > 0 %}
{% if featured_posts | length > 0 %}

All Posts

{% end %}
{% for post in regular_posts %} {# Showcase: Use {% continue %} to skip draft posts #} {% if post?.is_draft %} {% continue %} {% end %} {{ article_card(post, show_excerpt=true) }} {% end %}
{% end %} {# ===================================================================== PAGINATION - Using range expressions for page numbers ===================================================================== #} {% if total_pages > 1 %} {% end %} {% elif archive_subsections | length > 0 %} {# ===================================================================== SUBSECTIONS - Using {% embed %} for card composition ===================================================================== #}

Sections

{% for subsection in archive_subsections %} {% let sub_title = subsection?.title ?? 'Section', sub_href = subsection?.href ?? '#', sub_desc = subsection?.params?.description ?? '', sub_pages = subsection?.pages ?? [], sub_count = sub_pages | length %} {# Card for subsection - using standard article pattern #}

{{ sub_title }}

{% if sub_desc %}

{{ sub_desc }}

{% end %} {% match sub_count %} {% case 0 %}No pages yet {% case 1 %}1 page {% case n %}{{ n }} pages {% end %}
{% end %}
{% else %} {# ===================================================================== EMPTY STATE - Using {% unless %} for negative conditional ===================================================================== #}

No posts in this archive yet.

{% with section as sec %} {% let section_path = sec?.path %} {% let content_dir = site?.content_dir %}

To add posts:

  • Create a post with a date: content/{{ section_path.relative_to(content_dir) if section_path and content_dir else '' }}/my-post.md
  • Add frontmatter with date: 2025-01-01

💡 Posts in this section will be displayed in reverse chronological order.

{% end %}
{% end %}
{% end %}