# Template Cookbook URL: /bengal/docs/build-sites/customize/recipes/ Section: recipes Tags: cookbook, templates, kida, examples, persona-themer -------------------------------------------------------------------------------- Template Cookbook Practical examples showing how to accomplish common tasks with Bengal's templating system. Note 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 or Kida How-Tos. List Recent Posts Query and display recent content using Bengal's filters Group by Category Organize content into groups using Bengal's group_by filter Filter by Multiple Tags Query content matching multiple criteria using Bengal's filters Show Reading Time Display estimated reading time using Bengal's reading_time filter Add Table of Contents Use Bengal's auto-generated page.toc for navigation Series Navigation Add prev/next navigation for multi-part tutorials and series Template Views Use normalized View objects for consistent access to endpoints, schemas, and tags Author Byline Display author information with avatar and social links Social Sharing Buttons Add share buttons for Twitter, LinkedIn, Facebook, and more Archive Page Create year and month archive pages for blog content Blog Comments Configure and integrate comments (Giscus, Disqus, Utterances) on blog posts Content Freshness Show "new" badges and staleness warnings based on content age Featured Posts Highlight featured content in sidebars and homepages Section Statistics Display post counts, word counts, and reading time totals Content Queries Work with pages, sections, and taxonomies. Example What You'll Learn List Recent Posts where, sort_by, limit filters Group by Category group_by filter, nested loops Filter by Multiple Tags Chaining filters, in operator Archive Page group_by_year, group_by_month filters Featured Posts section.featured_posts, highlighting content Template Views EndpointView, SchemaView, TagView normalized objects Page Features Add features to individual pages. Example What You'll Learn Add Table of Contents page.toc, scroll highlighting Show Reading Time page.reading_time property and filter Content Freshness age_days, age_months, "new" badges Author Byline page.author, avatars, social links Series Navigation prev_in_series, next_in_series Social Sharing Buttons share_url(), platform share links Section Statistics post_count, word_count, totals Blog Comments params.comments, Giscus, Disqus, Utterances Quick Reference The Essentials {# 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 for the complete reference. -------------------------------------------------------------------------------- Metadata: - Author: lbliii - Word Count: 442 - Reading Time: 2 minutes