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

How to add category name in to title tag

007x

New member
#1
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?
 

Steve F

Well-known member
#2
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.
 

OperaManiac

Well-known member
#3
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!
 

Jake Bunce

XenForo moderator
Staff member
#4
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.
 

OperaManiac

Well-known member
#5
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?
 

OperaManiac

Well-known member
#7
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?
 

Steve F

Well-known member
#11
XenForo is well optimized for SEO out of the box, my post was an example of that. If it needed more I'm sure the developers would have added it.