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

Featured posts on top of list of posts

  • #8810
    Avatar photo[anonymous]

    Dear all –

    I marked some of my posts as featured.

    As long as they marked as featured, I want them to be listed on top, e.g.:

    1. featured post from last week
    2. normal post from today
    3. normal post from yesterday
    4. ….

    I neither found a description in the docs nor here on how to to that…

    Thanks in advance, Michael

    #8814
    Avatar photoBob

    I’m afraid there’s no way to display a post by date range; we can filter and display them according to the most recent or oldest entry.

    e.g. https://getpublii.com/dev/getpostsbytags-helper/

    #8816
    Avatar photo[anonymous]

    what a pity. I was thinking of the functionality of the sticky posts in WordPress. Maybe an idea for future releases? Cheers, Michael

    #8846
    Avatar photo[anonymous]

    Doesn’t that depend on your theme?

    Editorial shows a featured post at the top, for example. And Taste lets you display a featured post in the hero section.

    #8858
    Avatar photo[anonymous]

    Hi, privii,

    thanks a lot for your suggestion. It gave me the right direction 🙂

    I now use this structure, and it works fine in my theme:

    {{> head}}
    {{#if @renderer.isFirstPage}}
    {{#featuredPosts}}
    <article>
    </article>
    {{/featuredPosts}}
    {{/if}}
    
    {{#each posts}}
    <article>
    </article>
    {{/each}}
    {{> footer}}