atom-engine 5.0.2

A component-oriented template engine built on Tera with props, slots, and provide/inject context
Documentation
{# Test: Full Page Demo - Blog Layout #}
{% extends "base.html" %}

{% block title %}{{ title }}{% endblock %}

{% block extra_head %}
<style>
    .post { margin: 20px 0; }
    .post h2 { color: #333; }
    .post .meta { color: #666; font-size: 0.9em; }
    .post .tags { margin-top: 10px; }
    .post .tag { background: #eee; padding: 2px 8px; border-radius: 3px; margin-right: 5px; }
</style>
{% endblock %}

{% block header %}
<header class="site-header">
    <h1>{{ site_name }}</h1>
    <nav>
        {% for item in nav_items %}
        <a href="{{ item.url }}">{{ item.label }}</a>
        {% endfor %}
    </nav>
</header>
{% endblock %}

{% block content %}
<div class="content">
    <section class="posts">
        <h2>Latest Posts</h2>
        
        {% for post in posts %}
        <article class="post">
            <h3>{{ post.title }}</h3>
            <div class="meta">
                By {{ post.author }} on {{ post.date | date(format="%Y-%m-%d") }}
            </div>
            <p>{{ post.excerpt }}</p>
            
            {# Using @filter helper #}
            {% if post.tags | filter(key="featured", value=true) | length > 0 %}
            <span class="featured">Featured</span>
            {% endif %}
            
            <div class="tags">
                {# Using @each helper #}
                {% for tag in post.tags | each %}
                <span class="tag">{{ tag.value }}</span>
                {% endfor %}
            </div>
        </article>
        {% empty %}
        <p>No posts found.</p>
        {% endfor %}
    </section>
    
    <aside class="sidebar">
        <h3>Categories</h3>
        <ul>
            {# Using @group_by helper #}
            {% for category, posts in posts | group_by(attribute="category") %}
            <li>{{ category }} ({{ posts | length }})</li>
            {% endfor %}
        </ul>
        
        <h3>Popular Tags</h3>
        {# Get all tags, flatten, count unique #}
        {% set all_tags = posts | map(prop="tags") | flatten | map(prop="name") | uniq | sort %}
        <ul>
            {% for tag in all_tags %}
            <li>{{ tag }}</li>
            {% endfor %}
        </ul>
    </aside>
</div>
{% endblock %}

{% block footer %}
<div class="site-footer">
    <p>&copy; {{ year }} {{ site_name }}. All rights reserved.</p>
    
    {# Stack system demo #}
    {% call push(name="footer_scripts", content="<script>console.log('Analytics')</script>") %}
    {{ "footer_scripts" | stack }}
</div>
{% endblock %}