Ghost helper or alternatives to sort posts according to specific rule

hi, I’m new to the forum, my name is Michele and I’m an Italian Computer Science student. Lately I’ve been trying to develop a ghost project. I am looking for a method to create a custom grill in my home. I would like to create 6 lines which will go from 6 to 12 posts at most. A post takes up an entire line if the post contains a certain tag called “Gold”. otherwise the post will take up half of the line. In this case the line will be completed by the next post not containing Gold tag. I already have clear ideas about the (trivial) algorithmic strategy to obtain an ordering that allows me to do this. But being new to using ghost, I don’t understand how to create a helper that took a number of posts to give me this sorted array on which to then call my post-card.hbs for post rendering. in particular I have problems understanding where to write my function and how to register it. my version is 4.23. I currently use a local installation for testing but I also have a production installation on personal hosting

I hope you can help me. unfortunately the documentation for such use cases is a poor one for my current experience.
thank you

I think your best bet for doing something like this is using CSS Grid. You can see how Casper’s home page grid is done here:

Hi vikaspotluri123 and thanks for the reply. I cannot apply a strategy of this type a priori and I have already tried, but correct me if I’m wrong. I always need to fill in a maximum of six lines. Could be published in home 6 or 16 posts based on gold tags. the problem arises in cases where the order of the posts is something like this:

  1. no gold,
  2. gold,
  3. gold,
  4. no gold.
  5. no gold
  6. gold
  7. no gold
  8. no gold
  9. gold
  10. golg
  11. no gold

my three lines should therefore be composed like this:

obviously so the arrangement changes continuously making the home quite dynamic based on the latest posts published