Question about excluding a tag from the homepage

Hello,

I’m excluding certain posts from showing up on my homepage by modifying routes.yaml

I created an internal tag #noindex and modified my routes file as below:

  /:
    permalink: /{slug}/
    template: index
    filter: tag:-[hash-noindex]

The problem this has created is that the excluded post is NOT visible on the sitemap page: /sitemap-posts.xml

But this was never the intention. It was simply to show fewer things on the homepage. Not for the post to become invisible to search engines.

Is there a way to fix/reconcile this?

thanks!

So the reason those posts aren’t visible in the sitemap is because you never gave them a place to live - your routes currently say "For all posts not having the #no-index tag, they will live in /{slug}/". That’s it. You’re not giving a place for the #no-index posts to live. You can give them a place by adding a fallback route for the posts that don’t have a place, and once that happens, the posts should show up in your sitemap

Makes sense, thank you!
It works now.

  /:
    permalink: /{slug}/
    template: index
    filter: tag:-[hash-noindex]
  /otherposts/:
    permalink: /otherposts/{slug}/
    filter: tag:[hash-noindex]
1 Like