Closed ultraloveninja closed 3 years ago
Do you mean the full text of the most recent post?
Adding this to index.njk
should do it:
{% for post in postslist | head(-1) %}
<h1>{{ post.data.title }}</h1>
{{ post.templateContent | safe }}
{% endfor %}
Adding this to
index.njk
should do it:{% for post in postslist | head(-1) %} <h1>{{ post.data.title }}</h1> {{ post.templateContent | safe }} {% endfor %}
Interesting. I tried that and it comes back with a slice
error:
TypeError: Cannot read property 'slice' of undefined
Ok so using this ended up working:
{% set postslist = collections.posts | head(-1) %}
{% for post in postslist | head(-1) %}
<h1>{{ post.data.title }}</h1>
{{ post.templateContent | safe }}
{% endfor %}
I'm messing around with setting this, but I'm wondering, what is the setting to show the latest post on the home page?
I'm not sure if I'm missing something or if there's another resource to do that?