1. 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

Discussion in 'Styling and Customization Questions' started by 007x, Jul 26, 2012.

  1. 007x

    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?
     
  2. Steve F

    Steve F Well-Known Member

    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.
     
  3. OperaManiac

    OperaManiac Well-Known Member

    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!
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    In that same block of code, {$xenOptions.boardTitle} represents the title of your board. That can be removed if you wish.
     
  5. OperaManiac

    OperaManiac Well-Known Member

    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?
     
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Template changes like this persist through upgrades.
     
    OperaManiac likes this.
  7. OperaManiac

    OperaManiac Well-Known Member

    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?
     
  8. Ghostaunt

    Ghostaunt Active Member

    Same here. I'm trying to find a way to get the Category name in thread title tag for the SEO.
     
  9. Steve F

    Steve F Well-Known Member

  10. Ghostaunt

    Ghostaunt Active Member

  11. Steve F

    Steve F Well-Known Member

    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.
     

Share This Page