← Back to 11ty notes

How to access post content in template listing files

• 🍿 1 min. read

Why do this?

You might want to show the contents of posts in listings, like a social feed for example.

Solution:

In your eleventy template listing you can use

{{ entry.templateContent | safe }}

(with entry being whatever the post object name you are iterating on) which gets the contents of the post (markdown in my case), escapes it and makes it safe for use in the listing.

← Back to 11ty notes