Sign in
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

how to create a list of last updated posts

  • This topic has 2 replies, 2 voices, and was last updated 1 year, 1 month ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #9098

    Dear all –

    I would like to list posts which I updated. For the most recent posts I use this

    {{#each @website.contentStructure.posts}}
    but how to list the last updated posts ?

    Hi –

    I used a different approach, and tried to help myself 🙂

    I followed the instructions this page: and changed createdAt to modifiedAt.

    Working this way gives me a list of all modified posts for 2023, for example.

    What I still need

    • is a hint on how to limit the list to 5,
    • and on how to order the list in a timely manner…

    Cheers, Michael

    The screenshot shows the result I get by now

    A) the .hbs part:

      {{#each (yearsInArchive 2023)}} {{#if (getPostsByYear @website.contentStructure.posts this)}} {{#each (getPostsByYear @website.contentStructure.posts this)}}
    • {{date modifiedAt "YYYY-MM-DD"}}
    • {{/each}} {{/if}} {{/each}}


    B) and the helpers script:

    let themeHelpers = {
        yearsInArchive: function (startYear) {
            let years = [];
            let currentYear = new Date().getFullYear();
            for (let i = currentYear; i >= startYear; i--) {
            return years;
        getPostsByYear: function (posts, year) {
            return posts.filter(post => new Date(post.modifiedAt).getFullYear() === year);
    module.exports = themeHelpers;


    Avatar photogpsblues


    Have you tried a simple getPostsByTags?

    {{#getPostsByTags “count=5&allowed=hidden,featured&tag_as=id&tags=1,2,3&orderby=modifiedAt&ordering=asc”}}
    <h2>{{ title }}</h2>

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.