Ghost does not inject meta[name="robots"] in /page/[X]/ page

I want that search engines do not crawl /author/ and /page/[x]/ pages. In order to do so,following this link Add No Index meta tags to author pages, I have used {{{block "header"}}} before </head> tag and the following code in author.hbs and page.hbs

{{#contentFor "header"}}
  <meta name="robots" content="noindex">
{{/contentFor}}

After that I install the them, it is only the /author/ page that contains <meta name="robots" content="noindex">. But /page/[x]/ does not contains.


How to inject <meta name="robots" content="noindex"> in page.hbs?

page.hbs is used for static “page” pages, not index pages. I think you’re looking for the index.hbs template instead.

Thanks. Yes, I am looking for the index.hbs.

@Kevin Do you know how can I prevent it from being injected in home page?

You could use the home context, so you could do something like this

{{#unless "home"}}
{{#contentFor "header"}}
  <meta name="robots" content="noindex">
{{/contentFor}}
{{/unless}}

Thanks. It does not work. I used it in index.hbs, but stil there is no meta robots element inside <head>. I think the problem is with the context. If I do not use the #unless block, it is injected.


Just to be clear, with /page/[X]/, I mean https://example.com/page/2/.

Maybe try {{^is "home}}?

{{^is "home"}}
{{#contentFor "header"}}
  <meta name="robots" content="noindex">
{{/contentFor}}
{{/is}}

Hello!
Thank you for answers, it helped me a lot))
Please help me to add to autor, tag pages ends with /page/2/.
Example https://example.com/author/valerie/page/2/.
I tried
`{{^is "author/"slug}}

{{#contentFor “header”}}

{{/contentFor}}
{{/is}}`

but it didn`t help(
@vikaspotluri123 @Kevin