XF 1.5 Updating header for specific templates?

Peace

Active member
I have a few custom pages that use PAGE_CONTAINER.

I need to add some custom meta information in these pages (specifically og:image and og:title for Facebook). Unfortunately, I can't insert this stuff into page template because that's all within the <body> tags, and the meta information needs to be in the <header> tags.

This meta information cannot show for other pages that use PAGE_CONTAINER, only these specific ones.

I tried adding the meta information in PAGE_CONTAINER between some conditionals like:

<xen:if is="in_array({$contentTemplate}, array('mypage1', 'mypage2'))">

However, this doesn't work because the templates don't even load until after the header, so it can't detect which template it's in.

Is there a simple way to modify the header information in some specific templates?

Thanks!
 
<xen:if is="in_array({$contentTemplate}, array('mypage1', 'mypage2'))">

However, this doesn't work because the templates don't even load until after the header, so it can't detect which template it's in.
That actually should work. The container should know what content template it is rendering.

When on these pages, what value is displayed if you add:

{xen:helper dump, $contentTemplate}

Aside from this, it is actually possible to inject values into the header from the content template.

Look for usages of text similar to this in templates for an idea:

<xen:container var="$head.
 
Back
Top Bottom