Now, I’d like to implement something that picks out the most recently published post of the five displayed and give its an extra “newest” class. Is it possible to do this in handlebars, or do I need to do it via client-side javascript?
Yeah, that’s true, however, for my usecase that doesn’t matter, since they should always be published after each other. I guess a more stable way would be to do a seperate loop for each tag. Still, that doesn’t solve the issue with catching the newest one…
If you fix your order to sort by “published_at desc”, you’ll get the most recent post first and can use the @first helper. (Your current order setting looks invalid.)
yeah, but I want them to remain in the order they currently are, which is tag-1 on the left, tag-5 on the right, so I don’t want a “published_at” order. Is it possible to pull in all the publish dates, pick the latest one and give an extra class to a div?
The code you have should be giving you the published at order — that’s the default.
But if you want to order them by prinary_tag instead (which might be happening by accident right now), you could instead set an attribute within outer div for the post and then use JavaScript to get those values and style them.