Taxonomy Archives Template
Last Updated: April 20, 2026
First, create a taxonomy-framework.php file to handle taxonomy archives:
<?php
/**
* The template for displaying Framework taxonomy archives
*/
$context = Timber::context();
// Get the current taxonomy term
$context['term'] = new Timber\Term();
// Get the posts (snippets) associated with this taxonomy
$context['posts'] = Timber::get_posts();
// Render the Twig template
Timber::render('taxonomy-framework.twig', $context);
Code Snippet
Next, create the taxonomy-framework.twig template. This template will display the snippets in a card format.
{% extends "base.twig" %}
{% block content %}
<div class="container mx-auto px-4">
<h1 class="text-3xl font-bold mb-6">{{ term.name }}</h1>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
{% for post in posts %}
<div class="card bg-white shadow-md p-4 rounded-lg">
<h2 class="text-xl font-semibold mb-2">
<a href="{{ post.link }}" class="text-blue-600 hover:text-blue-800">
{{ post.title }}
</a>
</h2>
<p class="text-gray-600">{{ post.excerpt }}</p>
<a href="{{ post.link }}" class="inline-block mt-4 text-blue-600 hover:text-blue-800">
Read more
</a>
</div>
{% endfor %}
</div>
</div>
{% endblock %}
Important Notes/Warnings
After setting this up, make sure to flush your permalinks by going to Settings > Permalinks and clicking Save Changes.