Headline: Exclude tag from LATEST section

Using Headline and have a use case issue: Headline puts the most recent posts in the top LATEST section in chronological order. I’d like to be able to post some things only to email, like with a “newsletter” tag, and still have them available and archived on the website in a newsletter tag section.

I’m guessing there’s a quick filter I can include via code injection or the home page code to exclude certain tagged posts (e.g. “newsletter”) from the LATEST section?

You could use code injection on headline to make the unwanted posts disappear, but that won’t replace them.

<style>
.tag-your-tag-slug { display: none }
</style>

I don’t think you’ll like the results, however. It’s going to make holes.

A better option is to write a routes.yaml file that prevents the newsletter posts from going to the homepage. Here are the docs: Ghost Themes - Dynamic URLs & Routing

Be sure to upload the file from the labs section of /ghost > settings. It doesn’t go in the theme folder.

In this case, you’re going to want something like:

routes:

collections:
  /:
    permalink: /{slug}/
    template: home
    filter: tag:-newsletter

  /newsletter/:
    permalink: /{slug}/
    template: index
    filter: tag:newsletter

taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/

(Note that if you don’t put the newsletter posts into some collection, weird things will happen.)

Tip for anyone else reading and thinking they’ll use this for Source. Source doesn’t respect routing.

1 Like

Thanks @Cathy_Sarisky. I’ll confess that understanding routes, collections, and taxonomies has so far been a challenge, but I’ll dive back into those docs and see if I can make these changes without breaking anything.

CUT TO: Ghost(Pro) server bursting into flames, red lights flashing, sprinkler system activating

1 Like

Feel free to post again if you get stuck! The good news on the routes file is that if you mess it up, you can always load a new one. No servers will be harmed. :)