How to add category name in to title tag

007x

New member
Hi,

I want to know how to add a Category name in title tag of threads. currently xenforo add "thread name | forum title" in titles tag.

I want to put "thread name - Category name | forum title" in to html title tag.

Does anyone know how to do this?
 
In the PAGE_CONTAINER template near the top look for:

Code:
<title><xen:if is="{$title}">{xen:raw $title} | {$xenOptions.boardTitle}<xen:else />{$xenOptions.boardTitle}</xen:if></title>

Replace with this:

Code:
<title><xen:if is="{$title}">{xen:raw $title} | <xen:if is="{$contentTemplate} == 'thread_view'">{xen:raw $forum.title} |</xen:if> {$xenOptions.boardTitle}<xen:else />{$xenOptions.boardTitle}</xen:if></title>

I think this is what your asking for...Not sure if it has any ill affects anywhere else but it shouldn't. The conditional in there is to keep it from sending the tag twice when viewing discussion lists.
 
How do I remove the forum name from Thread Pages?
I mean here is what I am looking for specifically...

for the homepage
FORUM NAME
for forum pages
CATEGORY NAME - FORUM NAME
for thread pages
CATEGORY NAME - THREAD NAME

Thanks!
 
How do I remove the forum name from Thread Pages?
I mean here is what I am looking for specifically...

for the homepage
FORUM NAME
for forum pages
CATEGORY NAME - FORUM NAME
for thread pages
CATEGORY NAME - THREAD NAME

Thanks!

In that same block of code, {$xenOptions.boardTitle} represents the title of your board. That can be removed if you wish.
 
I am seeking different format for different sections of the forum. The code appears to be aimed at all the pages of the forum right? Let's see if I can make it work for myself. Thanks.

PS: Would these changes disappear on XenForo updates?
 
Code:
<title><xen:if is="{$title}">{xen:raw $title} | <xen:if is="{$contentTemplate} == 'thread_view'">{xen:raw $forum.title} |</xen:if> {$xenOptions.boardTitle}<xen:else />{$xenOptions.boardTitle}</xen:if></title>

Does not seem to work for me. Thread title tag is still not showing category/forum name just the board name. Has something changed in the last 2 years? I am pretty sure I have edited the right template and cleared the cache! Is there any documentation of the tags being used here?
 
Top Bottom