• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 How to disallow crawling complete RM and one Node through robots.txt

Sunka

Well-known member
#1
What to add in robots.txt file to disallow Google and other spiders from crawling complete Resources manager and one complete Category (included all in it)?
Thanks (y)
 

Mike

XenForo developer
Staff member
#2
If you just want to disallow the entire RM, then you can block /resources/. However, if you are trying to block a single category, you can't do this via robots.txt. You would need to modify the resource_view template:

Code:
<xen:if is="{$resource.resource_category_id} == 123">
<xen:container var="$head.noindex"><meta name="robots" content="noindex" /></xen:container>
</xen:if>
(I haven't tested this, so please check the code is being output when you expect.)
 

Mike

XenForo developer
Staff member
#4
Ah, the concept is similar but a different template/condition. You'd be checking thread_view and acting based on {$forum.node_id} .
 

Sunka

Well-known member
#5
You'd be checking thread_view and acting based on {$forum.node_id} .
If node ID is for example 123
This will be right code:

Code:
<xen:if is="{$forum.node_id} == 123">
<xen:container var="$head.noindex"><meta name="robots" content="noindex" /></xen:container>
</xen:if>
Where to put that code in thread_view template?