Excluding tag from index/home understanding

Hi,

I use liebling theme. 6.42.0 Ghost version, I have ssh access.

I have a tag “blog” which I use to categorize some posts in its specific category/tag collection, I don’t want to show them inside index/home post collection.

I read documentation about get/has/is/filter and routes documentaiton, I tried a lot of different types exclusions with filter and routes but I can’t get to understand how to exlude my “blog” tag inside index.hbs.

Here is what is used in index.hbs:

        {{#get "posts" filter="featured:true" include="authors,tags" limit="20" as |featured|}}

Here is my routes.yaml file :

routes:  

collections:
   /:     
     permalink: /{slug}/     
     template: index  
taxonomies:   
    tag: 
        /tag/{slug}/   
        author: /author/{slug}/

What would you advise me to do ?

I also want to show post date only in my “blog” tag collection page, not inside other tag collections pages, but here also I got stuck because of some logical stuff I didn’t understand with helpers.

Thanks a bunch for all the awesome work on Ghost <3

I tried with #has & #if but I couldn’t do it either. I’m still looking for a little help on this. I’m also ok if I need to use internal/hidden tags to make this works, thanks a bunch <3

This says “Get up to 20 posts, and only get posts that are featured.” #get requests do not respect routes.yaml.

So… to keep blog posts off (this part of) the homepage, update that to:

        {{#get "posts" filter="featured:true+tags:-[blog]" include="authors,tags" limit="20" as |featured|}}

Which says “get up to 20 posts that are featured and DO NOT have the blog tag.”

So you probably want something like this (within the {{#tag}} context:

{{#match slug "blog"}} put-your-date-code-here 
{{else}} do something else?
{{/match}}

Thank you so much @Cathy_Sarisky!

I think something’s happening elsewhere because it does not work either, here is my index.hbs :

        {{#get "posts" filter="featured:true+tags:-[blog]" include="authors,tags" limit="3" as |featured|}}
          {{#if featured}}
            <div class="m-featured-slider swiper js-featured-slider">
              <div class="m-featured-slider__list swiper-wrapper">
                {{#foreach featured}}
                  <div class="m-featured-slider__list__item swiper-slide">
                    <article class="m-featured-article {{#unless feature_image}}no-picture{{/unless}}">
                      <div class="m-featured-article__picture">
                        {{#if feature_image}}
                          <style>
                            #featured-bg-{{id}} {
                              background-image: url({{img_url feature_image size='l'}});
                            }
                            @media(max-width: 768px) {
                              #featured-bg-{{id}} {
                                background-image: url({{img_url feature_image size='m'}});
                              }
                            }
                          </style>
                          <div id="featured-bg-{{id}}"></div>
                        {{/if}}
                      </div>
                      <div class="m-featured-article__meta">
                        {{#if primary_tag}}
                          <a href="{{primary_tag.url}}" class="m-featured-article__tag">{{primary_tag.name}}</a>
                        {{/if}}
                      </div>
                      <div class="m-featured-article__ribbon">
                        <span class="icon-star"></span>
                        <span>{{t "Featured"}}</span>
                      </div>
                      <a href="{{url}}" class="m-featured-article__content">
                        <h2 class="m-featured-article__title js-featured-article-title" title="{{title}}">
                          {{title}}
                        </h2>
                      </a>
                    </article>
                  </div>
                {{/foreach}}
              </div>
              <button class="m-icon-button in-featured-articles swiper-button-prev js-featured-slider-button" aria-label="{{t "Previous"}}">
                <span class="icon-arrow-left" aria-hidden="true"></span>
              </button>
              <button class="m-icon-button in-featured-articles swiper-button-next js-featured-slider-button" aria-label="{{t "Next"}}">
                <span class="icon-arrow-right" aria-hidden="true"></span>
              </button>
            </div>
          {{/if}}
        {{/get}}

I’m sorry, I may try to look again later, again thank you,

Does the theme have a home.hbs also?

Hi, sorry I had work so I couldn’t connect back onto my computer. I only have a index.hbs file, no home.hbs

That looks like it should get the featured posts without the blog tag. Is the slug of the blog tag exactly “blog”? You don’t actually have #blog (which would be hash-blog) do you?

Sorry,

I got busy again, thanks a lot for your help, I really should offer you a tea at this point :sweat_smile:

slug is “blog”, name is “Blog :woman_mage:”, sorry I didn’t understand slug/tag/collection differences x|

I think I copied wrong part of code, main loop that get cards from my articles was in partials/loop.hbs because at some point it is written {{> "loop"}}in my index.hbs file.

I tried to use something like {{#is "home"}} blabla {{/is}} but I got stuck on filtering my blog tag again :

```
{{!-- The template below includes the markup for each post --}}

{{#is “home”}}
{{#get “posts” include=“tags” filter=“slug:blog”}}
{{#foreach posts}}
{{#is “post”}}


{{/is}}

{{#if feature_image}} {{/if}} {{#if featured}} {{/if}}

{{title}}

{{#if tags}} {{#foreach tags limit="5"}} {{name}} {{/foreach}} {{else}} {{/if}}
{{#is "post"}}
{{/is}} {{else}}

{{t "No posts found"}}

{{t "Apparently there are no posts at the moment, check again later."}}

{{/foreach}} {{/get}} {{/is}} \`\`\`