Can I include Posts while getting Tags?
e.g. {{#get “tags” limit=“all” include=“posts” }}
If yes: I want to get all tags and include a limited number of posts (4 posts with each tag). How can I achieve that?
Note: This question does not mean just counting posts but including whole posts.
Hey there @raushmrsn . You can use a #get
inside a #get
to get all the posts from each tag. Something like this would do it:
{{#get "tags" limit="all"}}
{{#foreach tags }}
<h2>Filed under: {{name}}</h2>
<ul>
{{#get "posts" filter="primary_tag:{{slug}}" limit="4"}}
{{#foreach posts}}
<li class="tag-{{slug}}"><a href="{{url}}">{{title}}</a></li>
{{/foreach}}
{{/get}}
</ul>
{{/foreach}}
{{/get}}
1 Like