How to render a dynamic title in pages generated from data in 11ty

Posted on November 18, 2023

This is the way to render the page title when you're creating pages dynamically using data.

The variable you'd use in the template is not accessible for the title property.

So this is the trick:

  data: posts
  size: 1
  alias: post
permalink: "posts/{{ post.slug }}/"
  title: "{{ post.title }}"

  {{ post.title }}