How to: Sticky post(s)

Hey there,
do you have any best practices how to make posts “sticky”? Given our standard $articles = $site->children()->visible(), I want to sort / group it so that:

  • sticky posts show first
  • then all other posts

In my blueprint, I got a checkbox field named sticky, so that’s either 0 or 1. Do I have to group all posts with sticky() == 1 first? There got to be an easy way …

Thx!

Three options:

  • sortBy() that field and then by date
  • work with two collections which you filter by the value of the sticky field
  • use groupBy() to group your post collection by this field

Will try that, thanks!

Works like a charm, plus you don’t need to flip stuff :sunny:

… which would give you …