How to render a dynamic title in pages generated from data in 11ty
•
1 min read
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:
---
pagination:
data: posts
size: 1
alias: post
permalink: "posts//"
eleventyComputed:
title: ""
---
<h1>
</h1>
Note: The permalink: "posts//" in the example above is specific to that use case. For regular log posts, the permalink is automatically set by log.json.