XF 2.1 Am I using $head right?


Active member
I wanted to add some custom html into the <head></head> and then I saw this in PAGE_CONTAINER:
    <xf:foreach loop="$head" value="$headTag">

So in my template that I am loading through my controller, I have something like this:
<xf:page option="head.abc" value="{$customHead}" />

With $customHead being passed as a param. This seems to work fine but for my OCD brain, I wanted to ask if this is the correct way to use $head because I couldn't find any examples of its use anywhere.


Jeremy P

XenForo developer
Staff member
You can use:

<xf:head option="abc">{$customHead}</xf:head>

It technically boils down to the same thing, but it's a bit cleaner/clearer. Depending on how you're building {$customHead} it may make more sense to do it directly in the template, but I suppose that's a different matter.