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

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.
 
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>
 
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>
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?
 
I'm not sure what you mean by the HTML title.

A screenshot may help.
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?
 
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.
 
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.
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.
 
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.
 
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.
How can I edit the PAGE_CONTAINER template so that the board title is suffixed in all pages except the homepage/index?
 
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.
How can I edit the PAGE_CONTAINER template so that the board title is suffixed in all pages except the homepage/index?
 
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.
 
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.
Perfect, that worked. Thank you.
 
Top Bottom