Order by date DESC but skip 1

Sarah Bartell asked on May 2, 2018 21:26

I can't find the answer to this anywhere and I'm assuming its easy.

Basically on our blog home page I have a repeater set up to show the most current blog at the top of the page as the "Featured post" and then under it, another repeater to show the next 9 posts, all ordered by date desc.

Currently both are set to Order By: BlogPostDate DESC but then the featured post is repeated as the first of the 9 below it. What do I have to add to my 2nd repeater to skip the most recent post and only show the next 9?

I'm using two repeaters for ease of style, as the top post spreads across the page and the next 9 are 3x3 layout.

Recent Answers


Zach Perry answered on May 2, 2018 22:01 (last edited on May 2, 2018 22:01)

Not sure of a way to do it using a repeater unless you use a custom query. If you use a custom query you can do something like this

Another option would be inside the transformation, check if it's the first item, if so do nothing, otherwise display it. Just make sure you pull back 1 more than you want to display in this scenario.

0 votesVote for this answer Mark as a Correct answer

Sarah Bartell answered on May 2, 2018 22:39

Nevermind, I realized I can accomplish this using the universal viewer and hierarchical transformations. thank you though!

0 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on May 3, 2018 01:26 (last edited on May 3, 2018 01:34)

You can use one repeater with ORDER BY BlogPostDate DESC and get all your items in one query and style your items with pure CSS:

<style>
div.section > div {
    background: green;
}
div.section > div:first-child  {
    background: yellow;
}
</style>
<div class="section">
   <div>Featured</div>
   <div>Item 1</div>
   <div>Item 2</div>              
   <div>Item 3</div>
    ...           
   <div>Item 9</div>
</div>
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.