CMS Development

Anton
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

remove Blog /tag URLs from Search Engine indexation

SOLVE

Hey guys,

as the title says -a client wants to remove all /tag URLs from a specific blog from indexing. Is there a "simple" way to achieve this? I know that you can "globaly" add

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

in Settings->Website->Blog->templates to the blog posting and blog listing templates but as he wants to remove only the /tag URLs neither of those two would work. Adding this to the "blog posting" header wouldn't help and adding the code to the listing view would also affect the default listing view - what's not the goal here.

 

I've told him about the solution with a custom robots.txt, but he's now happy about that. Excluding the /tag/* URLs in the Google Search Console is also not an option as it'll only affect the google results(who knows which other Search Engine the user uses).

 

Does anyone have a solution or idea how to achieve this?

 

Note: The client also told me that he want's a userfriendly and "easly scaleable" solution. 

 

thanks in advance

 

best, 

Anton

Anton Bujanowski Signature
0 Upvotes
1 Accepted solution
alyssamwilie
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

remove Blog /tag URLs from Search Engine indexation

SOLVE

In the blog listing markup you can target just the topic/tag pages by using the following if statement:

 

{% if topic %}
    <meta name="robots" content="noindex,nofollow">
{% endif %}



Alyssa Wilie
Web Developer
LyntonWeb 

If this answer solved your question, please mark it as the solution.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.

View solution in original post

7 Replies 7
PBifaro
Member

remove Blog /tag URLs from Search Engine indexation

SOLVE

I tried adding this to the blog listing template header section and it just shows at the top of the page.

Where is this supposed to go?

 

PBifaro_0-1693331583045.png

 

0 Upvotes
Anton
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

remove Blog /tag URLs from Search Engine indexation

SOLVE

Hi @PBifaro,

unless you want to go a custom module way you can drop 

 

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

 

in the Header-HTML part in the blog settings here:

settings(gear icon top right) -> Website -> Blog -> Templates -> Blog listing pages header HTML and/or Blog post header HTML

 

 

best, 

Anton

Anton Bujanowski Signature
0 Upvotes
alyssamwilie
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

remove Blog /tag URLs from Search Engine indexation

SOLVE

In the blog listing markup you can target just the topic/tag pages by using the following if statement:

 

{% if topic %}
    <meta name="robots" content="noindex,nofollow">
{% endif %}



Alyssa Wilie
Web Developer
LyntonWeb 

If this answer solved your question, please mark it as the solution.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.
Anton
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

remove Blog /tag URLs from Search Engine indexation

SOLVE

hi @alyssamwilie

thanks for the quick and easy solution. It works fine. 

Did a small addition so the meta-tag will be added to the head.

 

My code:

{% if topic %}
<script>
$('head').append( '<meta name="robots" content="noindex,nofollow">' );
</script>
{% endif %}

 

Thanks again!

 

best, 

Anton

Anton Bujanowski Signature
0 Upvotes
PBifaro
Member

remove Blog /tag URLs from Search Engine indexation

SOLVE

So this goes into setting > Advanced Settings > Head HTML

 

copy and paste as is or do I need to wrap this in <>

0 Upvotes
RNWilkinson
Participant

remove Blog /tag URLs from Search Engine indexation

SOLVE

Hi Anton,

I am trying to do the same, but I'm having some trouble. Does this code need to go into our blog listing template or the original HubSpot version?

Thanks,

Neal

Edit

This code worked like a charm - our template used a base html file for headers and footers, so I just needed to apply this code in there, rather than the blog template specifically. Works great. Thanks to Alyssa and Anton.

0 Upvotes
PBifaro
Member

remove Blog /tag URLs from Search Engine indexation

SOLVE

this did n't work for the template

 

0 Upvotes