Log in Sign up

Recent Entries not working

So I have a markdown file where I want to show some recent entries at the end. According to the reference, this should work:

{{#recent_entries}}
    <p><a href="{{url}}">{{title}}</a><br>
    {{#date}}<span itemprop="datePublished" content="{{dateStamp}}">{{date}}</span>{{/date}}</p>
{{/recent_entries}}

But it doesn't, unfortunately. I just get a blank space where the recent entries should be. :(

Also, the reference says it shows the 30 most recent posts. That's too many for my needs. Is there a way to limit that to 5?

Thanks!


2 years ago, 6 replies   developers   Edit question

Just add a bit more info here - I've injecting the code into a markdown page with {{> recent-posts}} this works fine on my error.html page for whenever a 404 is displayed, but it just won't work on the MD page.

I assumed it was something to do with the fact it was a Markdown page, so I changed it to HTML, but that didn't work either. :-(

Answered 2 years ago · Edit answer

Are you trying to embed the recent entries in a page or post, or in a template view? At the moment, you can't use template code in posts or pages, only in template views

In terms of limiting the number of recent entries: you can use CSS to hide all but the first five items

Answered 2 years ago · Edit answer

I'm trying to embed into a page. If that's the case, can I create a template view and use that as the page?

Answered 2 years ago · Edit answer

It's ok, I figured it out - managed to add it using package.json. Thanks for the CSS tip too.

Answered 2 years ago · Edit answer

Great! Please don't hesitate to ask if you have any questions

Answered 2 years ago · Edit answer

This is a great reference. I'm trying to avoid displaying the most recent entry in the list (since I'm showing it in the main blog page). I have the recent entries wrapped in a "recent" div and I'm targeting the

tag using this code:

.recent p:first-child { display: none;
}

It's still displaying the most recent post. Any idea what I'm doing wrong? Thanks!

Answered 2 years ago · Edit answer