Select posts in the wanted order using Ghost's handlebars


#1

I want to select the elements in this order:

1

2, 3, 7, 8, 12, 13, 17, 18

4, 5, 6, 9, 10, 11, 14, 15, 16

In CSS I would do something like this:

:first-of-type

:nth-of-type(5n + 2),
:nth-of-type(5n + 3)

:nth-of-type(5n + 4),
:nth-of-type(5n + 5),
:nth-of-type(5n + 6)

================  <- 1
=======  =======  <- 2, 3
====  ====  ====  <- 4, 5, 6
=======  =======  <- 7, 8
====  ====  ====  <- 9, 10, 11
=======  =======  <- 12, 13
====  ====  ====  <- 14, 15, 16

How can I do it using Ghost 's handlebars? I found this in the docs:

{{#has number="nth:3"}}

It seems that I need to select the first item separately, because it does not fit into the order that can be done using Ghost. Can I somehow slice the list of posts to remove the first one? Then the nth should work (I guess). Or is there some better way?


#2

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.