Your sites Log in Sign up Menu

Is there a way to get first few posts with a certain tag?

I would like to customize my template so the home page has a couple sections that show the first 3 posts of a couple different tags.

So far I have

{{#all_entries}}
  {{#tagged.SomeTag}}
      {{title}}
    {{#tagged.SomeTag}}
{{/all_entries}}

But I'm not sure if I'm able to limit all_entries or access certain elements of the array with Mustache.

Also, is there a way to combine inverted sections? Like if I want to filter out multiple tags from all_entries?


8 months ago, 2 replies   developers   tags   Improve this question

You'll need to use CSS to limit the number of entries displayed for a given tag after filtering – this is not yet possible with Blot's template engine. Here's a list of useful n-th child recipes if needed to help with this.

You can nest the filters and inverted sections as many times as you want, e.g. to list all entries with both the tags 'Apple' and 'Banana' but which do not have the tag 'Cherry':

{{#all_entries}}
  {{#tagged.Apple}}
    {{#tagged.Banana}}
       {{^tagged.Cherry}}
        ...
       {{/tagged.Cherry}}
    {{/tagged.Banana}}
  {{/tagged.Apple}}
{{/all_entries}}
Answered 8 months ago · Improve this answer

Thanks! I'll give that a go.

Answered 8 months ago · Improve this answer