How to access post content in template listing files

6th November 2022

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

{% raw %}{{ entry.templateContent | safe }}{% endraw %}

(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.