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

XF 1.4 How to shorten title for all pages except Homepage?

Discussion in 'XenForo Questions and Support' started by XFuser, Apr 12, 2015.

  1. XFuser

    XFuser Active Member

    One normally wants the homepage title to be as descriptive as possible, so it's generally quite long.

    However, since XF automatically adds the full homepage title to all Forum Nodes, the titles of the Nodes then become excessively long.

    So how can you used a shortened version of the homepage title for the Nodes?

    For example, let's say you have a Car Forum and your homepage title is:

    CarForum.com - The best place to discuss cars for automobile enthusiasts

    If you have a Forum Node called "Ford", then that Forum Node will have the title:

    Ford | CarForum.com - The best place to discuss cars for automobile enthusiasts

    Which looks long and ridiculous.

    So how can you make it so that the Nodes use a shortened titled (e.g. CarForum.com) so that the title of the Nodes look more professional, such as:

    Ford | CarForum.com

    Without affecting the longer homepage title?

    Please advise. Thank you.
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    If by homepage title you mean the forum index, you can change the board title in the ACP to the short version and then edit the forum_list template and change the board title to your longer version.

    Just replace the content in the xen:h1 tags.
    Code:
    <xen:h1>{$xenOptions.boardTitle}</xen:h1>
     
  3. XFuser

    XFuser Active Member

    I mean the HTML title of the Forum homepage / index that lists all the Nodes.

    What you suggested will fix the Node titles, but not the long HTML title of the homepage / index.

    How can the HTML title of the homepage / index be made longer after shortening the official board title in the ACP?
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    I'm not sure what you mean by the HTML title.

    A screenshot may help.
     
  5. XFuser

    XFuser Active Member

    I mean this part (from the HTML source <head></head> section):
    Code:
    <title>CarForum.com - The best place to discuss cars for automobile enthusiasts</title>
    How can I have one longer HTML title for the homepage/index, and a shorter one for the rest of the site?
     
  6. Mike

    Mike XenForo Developer Staff Member

    You can change that on a given page by putting:
    Code:
    <xen:title>...</xen:title>
    in the appropriate template. For the forum list, that'd be forum_list.

    If you want the actual header on the page to be different, that'd be changed with:
    Code:
    <xen:h1>...</xen:h1>
    You can see the actual <title> tags being output in PAGE_CONTAINER.
     
  7. XFuser

    XFuser Active Member

    Changing the Board Title to, for example, "CarForum.com" and then doing as you suggested results in the following redundant title on the homepage/index:

    CarForum.com - The best place to discuss cars for automobile enthusiasts | CarForum.com

    How can this be fixed so it just outputs the following HTML Title in the homepage/index:

    CarForum.com - The best place to discuss cars for automobile enthusiasts

    and the following HTML Title everywhere else:

    [Forum Node Title] | CarForum.com

    Thank you.
     
  8. Mike

    Mike XenForo Developer Staff Member

    The board title is always suffixed if there's a title specified. This is why I mentioned PAGE_CONTAINER. If you want to change the logic, you'd need to edit that template.
     
  9. XFuser

    XFuser Active Member

    How can I edit the PAGE_CONTAINER template so that the board title is suffixed in all pages except the homepage/index?
     
  10. XFuser

    XFuser Active Member

    How can I edit the PAGE_CONTAINER template so that the board title is suffixed in all pages except the homepage/index?
     
  11. Mike

    Mike XenForo Developer Staff Member

    Well, you can revert any changes to the forum_list template and, in PAGE_CONTAINER, change the "else" case in the <title> tag to have whatever you want your "long" title to be. Your board title should then be your short title.
     
    XFuser likes this.
  12. XFuser

    XFuser Active Member

    Perfect, that worked. Thank you.
     

Share This Page