Adding noindex as meta tag to specific headers in a theme

Hi, I am quite new to Hugo so sorry if this is a very noobie question. So I am using a theme that add separate page for each tag and category so you can search for article that have a specific tag. Though this is a good feature, but it is causing trouble for SEO purposes. My crawling budget is pretty low so I just want to add noindex tag to header of these pages.

The theme use below code to decide title of page:

<title>
        {{ if .IsHome }}
            {{ $.Site.Params.header.title }}
        {{ else }}
            {{ $.Page.Title }} |
            {{ $.Site.Params.header.title }}
        {{ end }}
    </title>

Now I want to have something similar to the above code, but instead, if the page title is for instance equal to “Tags | Mywebsitename”,“Category 1”,“Category 2”,…,“Tag 1”,“Tag 2”,… it adds the :

<meta name="robots" content="noindex">

to the header of that html page. I do not know how I can loop through all the tags and categories. I really appreciate if you oculd help me.

I wouldn’t go with the title.

If I got it what you want is getting the kind of page. And if it’s a term or taxonomy then add special code to taht page.

Check out this for getting the page kind andwp into an if clause