# Template Cookbook

URL: /bengal/docs/build-sites/customize/recipes/
Section: recipes
Description: Common templating patterns and Bengal-specific features

---

> For a complete page index, fetch /bengal/llms.txt.

Practical examples showing how to accomplish common tasks with Bengal's templating system.

Note

Do I need this? Use when you know what you want (recent posts, TOC, series
nav) and need a copy-paste Kida pattern. For syntax fundamentals, see
Kida Syntax (/bengal/docs/reference/kida-syntax/) or Kida How-Tos (/bengal/docs/build-sites/customize/templating/kida/).

List Recent Posts

Query and display recent content using Bengal's filters

(/bengal/docs/build-sites/customize/recipes/list-recent-posts/)

Group by Category

Organize content into groups using Bengal's group_by filter

(/bengal/docs/build-sites/customize/recipes/group-by-category/)

Filter by Multiple Tags

Query content matching multiple criteria using Bengal's filters

(/bengal/docs/build-sites/customize/recipes/filter-by-tags/)

Show Reading Time

Display estimated reading time using Bengal's reading_time filter

(/bengal/docs/build-sites/customize/recipes/reading-time/)

Add Table of Contents

Use Bengal's auto-generated page.toc for navigation

(/bengal/docs/build-sites/customize/recipes/table-of-contents/)

Series Navigation

Add prev/next navigation for multi-part tutorials and series

(/bengal/docs/build-sites/customize/recipes/series-navigation/)

Template Views

Use normalized View objects for consistent access to endpoints, schemas, and tags

(/bengal/docs/build-sites/customize/recipes/template-views/)

Author Byline

Display author information with avatar and social links

(/bengal/docs/build-sites/customize/recipes/author-byline/)

Social Sharing Buttons

Add share buttons for Twitter, LinkedIn, Facebook, and more

(/bengal/docs/build-sites/customize/recipes/social-sharing-buttons/)

Archive Page

Create year and month archive pages for blog content

(/bengal/docs/build-sites/customize/recipes/archive-page/)

Blog Comments

Configure and integrate comments (Giscus, Disqus, Utterances) on blog posts

(/bengal/docs/build-sites/customize/recipes/blog-comments/)

Content Freshness

Show "new" badges and staleness warnings based on content age

(/bengal/docs/build-sites/customize/recipes/content-freshness/)

Featured Posts

Highlight featured content in sidebars and homepages

(/bengal/docs/build-sites/customize/recipes/featured-posts/)

Section Statistics

Display post counts, word counts, and reading time totals

(/bengal/docs/build-sites/customize/recipes/section-statistics/)

## Content Queries

Work with pages, sections, and taxonomies.

Example
What You'll Learn

List Recent Posts (./list-recent-posts/)
`where`, `sort_by`, `limit`filters

Group by Category (./group-by-category/)
`group_by`filter, nested loops

Filter by Multiple Tags (./filter-by-tags/)
Chaining filters,`in`operator

Archive Page (./archive-page/)
`group_by_year`, `group_by_month`filters

Featured Posts (./featured-posts/)
`section.featured_posts`, highlighting content

Template Views (./template-views/)
`EndpointView`, `SchemaView`, `TagView`normalized objects

## Page Features

Add features to individual pages.

Example
What You'll Learn

Add Table of Contents (./table-of-contents/)
`page.toc`, scroll highlighting

Show Reading Time (./reading-time/)
`page.reading_time`property and filter

Content Freshness (./content-freshness/)
`age_days`, `age_months`, "new" badges

Author Byline (./author-byline/)
`page.author`, avatars, social links

Series Navigation (./series-navigation/)
`prev_in_series`, `next_in_series`

Social Sharing Buttons (./social-sharing-buttons/)
`share_url()`, platform share links

Section Statistics (./section-statistics/)
`post_count`, `word_count`, totals

Blog Comments (./blog-comments/)
`params.comments`, Giscus, Disqus, Utterances

## Quick Reference

### The Essentials

kida
KIDA

```
{# Get pages from a section #}
{% let posts = site.pages |> where('section', 'blog') %}

{# Sort by date, newest first #}
{% let recent = posts |> sort_by('date', reverse=true) %}

{# Limit to 5 #}
{% let latest = recent |> limit(5) %}

{# Or chain it all #}
{% let latest = site.pages
  |> where('section', 'blog')
  |> sort_by('date', reverse=true)
  |> limit(5) %}
```
### Common Filters

Filter
Purpose
Example

`where`
Filter by field
`pages |> where('draft', false)`

`sort_by`
Sort results
`pages |> sort_by('title')`

`limit`
Take first N
`pages |> limit(10)`

`group_by`
Group by field
`pages |> group_by('category')`

`first`
Get first item
`pages |> first`

Both`\|>` (Kida pipeline) and `\|` (Jinja-style) work. Examples use `\|>`for consistency.

See Template Functions (/bengal/docs/build-sites/customize/templating/functions/) for the complete reference.

## In This Section

Add Table of Contents (/bengal/docs/build-sites/customize/recipes/table-of-contents/)

Use Bengal's auto-generated page.toc for navigation

Archive Page (/bengal/docs/build-sites/customize/recipes/archive-page/)

Create year and month archive pages for blog content

Author Byline (/bengal/docs/build-sites/customize/recipes/author-byline/)

Display author information with avatar and social links

Blog Comments (/bengal/docs/build-sites/customize/recipes/blog-comments/)

Configure and integrate comments (Giscus, Disqus, Utterances) on blog posts

Content Freshness (/bengal/docs/build-sites/customize/recipes/content-freshness/)

Show "new" badges and staleness warnings based on content age

Featured Posts (/bengal/docs/build-sites/customize/recipes/featured-posts/)

Highlight featured content in sidebars and homepages

Filter by Multiple Tags (/bengal/docs/build-sites/customize/recipes/filter-by-tags/)

Query content matching multiple criteria using Bengal's filters

Group by Category (/bengal/docs/build-sites/customize/recipes/group-by-category/)

Organize content into groups using Bengal's group_by filter

List Recent Posts (/bengal/docs/build-sites/customize/recipes/list-recent-posts/)

Query and display recent content using Bengal's filters

Section Statistics (/bengal/docs/build-sites/customize/recipes/section-statistics/)

Display post counts, word counts, and reading time totals

Series Navigation (/bengal/docs/build-sites/customize/recipes/series-navigation/)

Add prev/next navigation for multi-part tutorials and series

Show Reading Time (/bengal/docs/build-sites/customize/recipes/reading-time/)

Display estimated reading time using Bengal's reading_time filter

Social Sharing Buttons (/bengal/docs/build-sites/customize/recipes/social-sharing-buttons/)

Add share buttons for Twitter, LinkedIn, Facebook, and more

Template Views (/bengal/docs/build-sites/customize/recipes/template-views/)

Use normalized View objects for consistent access to endpoints, schemas, and tags

Related Pages

Add a Custom Filter (/bengal/docs/build-sites/customize/templating/kida/add-custom-filter/)

Extend Kida with your own template filters

Related

Getting Started with Kida (/bengal/docs/tutorials/theming/getting-started-with-kida/)

Learn Kida template syntax from scratch with hands-on examples

Related

Kida Syntax (/bengal/docs/reference/kida-syntax/)

Kida template syntax overview — control flow, variables, functions, and pipelines

Related

Kida Syntax Reference (Detailed) (/bengal/docs/reference/kida-syntax-reference/)

Exhaustive Kida filter, operator, caching, and migration reference

Related

cookbook (/bengal/tags/cookbook/)

templates (/bengal/tags/templates/)

kida (/bengal/tags/kida/)

examples (/bengal/tags/examples/)

persona-themer (/bengal/tags/persona-themer/)
