Log in Sign up

Showing the latest blog post in the home page

How can I show the latest blog post in its entirety on the home page using Essay. The user could them scroll down to see more posts.


3 years ago, 3 replies   Edit question

The latest post inside your template's list of entries can be targeted using the following selector:

{{#entries}}

{{#first}} {{^pagination.previous}}

... Will appear only for the most recent entry ...

{{/pagination.previous}} {{/first}}

... Will appear for all entries ...

{{/entries}}

Answered 4 years ago · Edit answer

I have a similar question: I want to show my most recent blogpost title (and Link) on my landing page. How would I achieve that? Thank you very much!

Answered 4 years ago · Edit answer

To show this only on your landing page, you could use custom metadata. In the source file for the landing page, we'll add custom Latest metadata at the start:

Latest: yes
Link: /

Landing page content goes here...

And in your template's entry.html you would add the following:

{{#entry.metadata.latest}}
{{#recent_entries}} {{#first}} 

<a href="{{{url}}}">{{title}}</a>

{{/first}} {{/recent_entries}}
{{/entry.metadata.latest}}

If you wanted the most recent blogpost title after the landing page's main content, you would insert this after {{{html}}} in your template's entry.html file.

Answered 3 years ago · Edit answer