Logic of Casper2 theme


#1

Can someone help me understand this logic of Casper2 theme,
where there is bunch of post cards, and sometimes there are 3 cards,
sometimes, there are two, and sometimes there is only one that is wide

I’m interested in last one - when does it appear, and can I somehow make it appear
after 3 cards - whenever I want to.


#2

You can see how the home page is laid out here

The first (most recent) post in the list is styled to be bigger than the others and take over the full width of the grid to give it more emphasis. Wrapped in a media query to make sure this only happens on large viewports / desktop-ish devices.


#3

I can’t find html part that mentions that class


#4

The home page loops over the posts and renders this file


#5

ok. but I don’t see mention of home-template class anyhwere


#6

Oh, that’s added via the {{body_class}} helper


#7

btw. when I click on Feature this post, shouldn’t that post automatically always appear first?
That currently doesn’t happen for me.


#8

No, In ghost, featuring a post does not bring that post automatically at the first place. That post will appear at normal position in post’s order ( Ordered by published date ).


#9

what does featuring even mean then, exactly?

and - of course, how to make something appear first, then?


#10

I can’t explain this clearly. Maybe some more expert person can explain this. :smiley:

If you want to show featured post at a perticular place, you can use {{get}} helper https://themes.ghost.org/docs/get

{{#get "posts" filter="featured:true"}}
    {{! Loop through our featured posts }}
    {{#foreach posts}}
   	    {{title}} 
   	    {{! here you can output anything of a post object}}
    {{/foreach}} 
{{/get}}

This will only show the featured posts.


#11

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