m-e
January 13, 2025, 9:26am
1
Is there a way to ‘pin’ a blog article so that it displays first in the frontend - so that it is not listed by date?
I could update the date field, so that the article is always the most recent, but I was just wondering if there is any way to ‘pin’ an article.
you could create a custom toggle field for each blog article to toggle “pinned”, and use that to sort in frontend?
You can sort via multiple fields: Sorting collections | Kirby CMS
m-e
January 13, 2025, 1:39pm
3
Interesting… so I can sortBy ‘date’ and ‘pinned’ (and put pinned at the top). Like this?
$articles = page('blog')->children()->listed()->sortBy('pinned', 'date', 'desc');
Unfortunately my blog articles are sorted by Chronological sorting by date field
The date is being “added” to the Content folder name 20250113_article
And in my template I have this
<?php foreach($page->children()->listed()->flip() as $article): ?>
I’m not sure there is a way of removing a “pinned” article out of the above sorting, and display it at the top of the Blog article list? If not I might pivot to using sortBy
This is leading to the same question I had here
I’m adding my first blog to a site. I’ve followed this Cookbook Creating a blog | Kirby CMS
I have some basic questions:
I’ve created a few test article pages. In the Contents > Blog folder they are numbered like this:
1_your-first-article
2_your-first-article
3_your-first-article
4_your-first-article
And in the Panel the position of the articles can be reordered, by simply dragging the pages up or down.
Is this standard practise to be able to reorder blog articles, or should they be arrang…
What is the best way to sort Blog Articles?