How do I remove member-only pages from search engines?

Is there a way to hide certain types of pages from being discovered by general search engine crawlers? I’m not sure how to apply something like a robots.txt to Ghost unless I’m running it headless. Maybe there’s a simple way I’m not seeing?

If you want to do it on a per-post basis you can put <meta name="robots" content="noindex"> into the “Code injection - Post header” field.

Alternatively you can add the same meta tag via your theme for members-only posts…

In your default.hbs file (or equivalent) make sure you have a {{{block "head"}}} statement inside your <head> element. Then in your post.hbs you can have something like this:

{{#post}}
    {{#has visibility="members"}}
        {{#contentFor "head"}}<meta name="robots" content="noindex">{{/contentFor}}
    {{/has}}
....
3 Likes

Hi,
We have made this change… But what I don’t see on a members only post when I do a view source after logging in as a member is the meta tag
Instead there seems be an empty line there.

One another thing to mention is these posts are tagged paid-members only. Not sure if there is a change in the visibility check.

I am I missing anything here?

Ok I had to change it to “paid” for it to work.

    {{#has visibility="paid"}}