How to exclude certain tag from the list of latest post?

Hi! Folks,
I’m trying to exclude certain tag from the list of latest post, here is my code…

{{#get "posts" limit="9"}}
            <div class="col-lg-8">
                <div class="latest-post-section post-group">
                    <div class="post-group-title">
                        <span>{{t "Latest News"}}</span>
                    </div>
                    {{#foreach posts visibility="all"}}
                    {{#if @first}}
                    <div class="large-post clearfix">
                        {{#if feature_image}}
                        <a href="{{url}}">
                            <div class="featured-image-wrap">
                                <div class="featured-image">
                                    <img srcset="{{img_url feature_image size="s"}} 300w,
                                                {{img_url feature_image size="m"}} 600w"
                                        sizes="(max-width: 330px)300px, 600px"
                                        src="{{img_url feature_image size="m"}}"
                                        alt="{{title}}"
                                    />
                                </div>
                            </div>
                        </a>
                        {{/if}}
                        <div class="content-wrap{{^if feature_image}} no-image{{/if}}">
                            <h2 class="title h4"><a href="{{url}}">{{title}}</a></h2>
                            <time class="date" datetime="{{date format="YYYY-MM-DD"}}" title="{{date format="DD MMMM, YYYY"}}">{{date format="MMMM DD, YYYY"}}</time>
                            <div class="excerpt">{{excerpt words="30"}}</div>
                        </div>
                    </div>
                    {{/if}}
                    {{/foreach}}
                    <div class="row">
                        {{#foreach posts visibility="all"}}
                        {{^if @first}}
                        <div class="col-md-6 small-post">
                            {{#if feature_image}}
                            <a href="{{url}}">
                                <div class="featured-image-wrap">
                                    <div class="featured-image">
                                        <img src="{{img_url feature_image size="xs"}}" alt="{{title}}" />
                                    </div>
                                </div>
                            </a>
                            {{/if}}
                            <div class="content-wrap{{^if feature_image}} no-image{{/if}}">
                                <h2 class="title h5"><a href="{{url}}">{{title}}</a></h2>
                                <time class="date" datetime="{{date format="YYYY-MM-DD"}}" title="{{date format="DD MMMM, YYYY"}}">{{date format="MMMM DD, YYYY"}}</time>
                            </div>
                        </div>
                        {{/if}}
                        {{/foreach}}
                    </div>
                </div>
            </div>
            {{/get}}

But i don’t understand how to do that, may be anyone of you can help me…

Thx… :innocent:

What tag are you trying to exclude? I don’t see any code referencing a tag.

My first thought would be to use a filter on your #get posts at the top.

{{#get "posts" limit="all" filter="tag:-tagtoblock"}}

(Someone jump in here if I got the syntax wrong.)

2 Likes

Hi! @BruceInLouisville ,
Thank you so much for your help… It works well after i added filter=“tag:-%tagtoblock%” … :smile: