Puzzled noob question (sorta solved)

I’m looking through the Source theme, and am puzzled by some code.

There is a segment that begins with
{{#foreach posts limit=“1”}}

Okay, I understand that. But there is no #get command anywhere I can find. Does #foreach just grab the latest posts without needing a #get?

Okay, I dug around and found the Ghost documentation on #foreach. So, it iterates over whatever is passed to it (in this case, posts).

But, I didn’t see anything in the documentation about being able to filter a #foreach. I see it will take a limit attribute – but what about filtering for “featured=true”?

(I’m trying to edit the Source theme to only pull featured posts into the header-content.hbs file.)

Hey Bruce! You’d accomplish that with routing, so that only the posts you want are actually at that route.

(And then you’ll have to find all the #get requests peppered throughout Source. Source is sort of a pain.)

Ugh – I hate dealing with routes. I’ve been messing with Ghost for four years now, and I still don’t think I really understand them. I approach Routes.yaml like a bomb squad approaching a suspicious package. :flushed_face:

I’ll futz with putting a #get in front of the #foreach. Glad I have a local install to test on.

Just understand that you’re going to mess up pagination by using get instead of getting the routing right…

Well, I was able to get the upper section of Source/Highlight to show only featured posts, which is what I was going for.

But then I couldn’t get the lower section to show only non-featured posts. And you’re right: Source is an interesting code base.

So, I gave up and went back to my pretty-highly-customized version of Tripoli.