Hiding Posts From Homepage to Make a Newsletter Archive?

Hey all,

Since switching my newsletter over to Ghost, I’ve got three types of posts I send.

  1. Blog only.
  2. Blog posts I also send to subscribers
  3. Email only posts

What I want to do is collect the posts I send out only as emails (3) under a tag, so that prospective subscribers can peruse through past issues, but not have those show up on the homepage or really under posts at all.

Based on this guide, it seems like I should be able to do this by adjusting my routes.yaml file. I added the part after the comma next to “filter” and updated it to this:

routes:
  /signup/: members/signup
  /signin/: members/signin
  /rss/:
    template: rss
    content_type: text/xml

collections:
  /:
    permalink: /{slug}/
    filter: featured:false, tags:-hash-newsletter
    template: index 
  /featured/:
    permalink: /featured/{slug}/
    filter: featured:true
    template: index

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

What I expected was the ability to tag posts as “newsletter, #newsletter,” and have them not show up on the home page but on the tag page for “newsletter,” which I could then link to. I haven’t sent a new one out since trying to set this up, but I did make a test post with those two tags, and while it did show up under the newsletter tag, it also showed up on my homepage.

Am I doing something wrong here? Any help would be appreciated. Thanks!

It looks like your filter syntax is off. Try:

filter: featured:false+tags:-hash-newsletter

Thanks @RyanF! That made it so the posts don’t show up on the homepage, but do under the “newsletter” tag. However when I click on the post or go to the URL it should be at, it sends me to a 404. Same if I click the “View Post” link in the sidebar of the post.

Is there something else I need to do?

Progress :smile:

Collections are exclusive, which means that you need to give your newsletter posts another place to live. For example:

/newsletter/:
  permalink: /newsletter/{slug}/
  filter: tags:hash-newsletter
  template: index

Now, your newsletter posts have somewhere to live permanently, which is, newsletter/title-of-the-post

Definitely progress!

So, /newsletter goes to the newsletter landing page, so I swapped it to “newsletters,” but I’m getting an error when I try and upload.

Here’s my routes.yaml file I was trying to upload; do you see a syntax error here I might be missing?

routes:
  /signup/: members/signup
  /signin/: members/signin
  /rss/:
    template: rss
    content_type: text/xml

collections:
  /:
    permalink: /{slug}/
    filter: featured:false+tags:-hash-newsletter
    template: index 
  /featured/:
    permalink: /featured/{slug}/
    filter: featured:true
    template: index
  /newsletters/:
  permalink: /newsletters/{slug}/
  filter: tags:hash-newsletter
  template: index

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

Yep. YAML is whitespace sensitive, which means missing spaces is gonna break stuff. Under /newsletters/, you need to have two spaces before permalink, etc. It needs to be indented.

1 Like

Ah! Perfect. Everything’s working as expected now. Thanks so much for all your help!

1 Like