You can definitely filter posts by tag using the {{has}}
helper:
{{#foreach posts}}
{{#has tag="news"}}
{{> post}}
{{/has}}
{{/foreach}}
You could add this code to a home.hbs
file and it would only be used on your homepage.
I'm not sure of the best way to limit it to one post if you want other list pages to have more than one post though. You may have to write a custom helper.
You do have access to an @index
variable, but if the first post with 'news' is the third post, @index
will be 2
because it increments with the outer foreach
loop.
Soon you should be able to use the api: https://github.com/TryGhost/Ghost/wiki/%5BWIP%5D-API-Documentation
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…