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

Customizing Page Container code only when on a specific page type

#1
Hi There

(FYI - this is not JohnStevens, but someone helping him).

Anyhow... I'm decent at PHP but totally new to Xenforo. How would I say;

"IF the pagetype is a member profile page, add this customline of HTML"

Pretty sure I'd need to do this in the PAGE_CONTAINER template?

Thanks!
-Dan

PS - if you're curious, I want to add <meta name="robots" content="noindex"> to the <head> of member profile pages to prevent them from being indexed.

PPS - despite belief, robots.txt will not precent indexation... so definitely need to be able to do it the way mentioned above!
 

Chris D

XenForo developer
Staff member
#2
Hey there Dan.

Yeah here's exactly the thing you need:

It's actually much more simple and elegant.

In the template for the page you don't want to be indexed, e.g. in your case member_view template (the profile of each user):

Code:
<xen:container var="$head.robots">
	<meta name="robots" content="noindex" />
</xen:container>
That will place the relevant code in the head.

If you search all templates for "noindex" you will see where else this has been employed.