Hey. I need to close all category navigation pages. For example, I need to add noindex for the pages “/ section/page/X”
Can I do that?
Hey. I need to close all category navigation pages. For example, I need to add noindex for the pages “/ section/page/X”
Can I do that?
I have managed to do that to the categories and tags pages via the following. This code goes into where the rest of the code is on the header.
{{ if eq .Data.Singular .Kind "tags" }}<meta name="robots" content="noindex" />{{ end }}
{{ if eq .Data.Singular .Kind "category" }}<meta name="robots" content="noindex" />{{ end }}
The problem with Pagination pages is that it needs to be done in a specific way and I am still having problem with my theme.
You can see an example from the following URL. Do let me know if you have managed to fix it.
My section is ‘blog’:
{{ if eq .RelPermalink "/blog/" }}
{{ if ne .Paginator.PageNumber 1 }} <meta name="robots" content="noindex, follow">{{ end }}
{{ if .Paginator.HasNext }}<link rel="next" href="{{ .Paginator.Next.URL }}" />{{ end }}
{{ if .Paginator.HasPrev }}<link rel="prev" href="{{ .Paginator.Prev.URL }}" />{{ end }}
{{ end }}
The following code works…
{{ if eq .RelPermalink "/" }}
{{ if ne .Paginator.PageNumber 1 }} <meta name="robots" content="noindex, follow">{{ end }}
{{ end }}
However, when I try to add a description to the Home Page and other pages, it does not work…
<meta name="description" content="{{if .IsHome}}{{ $.Site.Params.description }}{{else}}{{.Description}}{{end}}" />
The following HTML code is outputted…
<meta name="description" content="" />
Any idea how I can get this to work?