How to Remove the Article ID from the Browser Title in sh404SEF

At itoctopus, we pride ourselves that we often give real solutions to common problems when no one else does! This morning was no different. We have solved a common problem with sh404SEF that even the creators of that extension claimed that there is no solution for.

Here’s the problem.

Let’s say you choose to include the ID of the article in the URL in sh404SEF’s settings: you make the change and you check your website, and you notice that everything works as it should (well, the ID of the article is in the wrong place, but we’ve already explained how to fix that), but you also notice something else. The ID of the article is, for some reason, in the browser title surrounded by brackets. So your browser title looks like the following:

You Article Title [The ID of the Article]

OK – you think – there must be a setting somewhere to remove the ID from the page title. So you go through every single setting in sh404SEF but to no avail. You then check the official extension forum, and you notice that many have asked the same question, but the answer came invariably: “If you choose to add the ID to the URL, then the ID will also be added to the page title – there’s no way around this.” The answerer then claims that it’s good for you. Well, we think that Joomla website owners have the right to decide themselves what’s good and what’s bad for them – including whether to have that ID or not in the page title.

Since sh404SEF was not helpful, we decided to find the solution ourselves. Our mission was clear: Find the sh404SEF file where the ID is being added and remove the code that adds the ID. To make a (very) long story short, we finally found the culprit. It was the file com_content.php located under the /components/com_sh404sef/meta_ext directory. The code responsible for adding the ID is the following (line 122 to 126):

if (!empty( $articleId)) {
	$lastBit = array_pop( $title);
	$lastBit .= ' [' . $articleId . ']';
	array_push( $title, $lastBit);
}

Removing the above lines just fixed the problem! It was that simple!

We have no idea why the people who created sh404SEF did not make adding the ID to the page title an option (most Joomla website owners wouldn’t want an ID in their page titles anyway) and refused to give the above solution for those who were experiencing the same problem.

If you (yes you!), our dear reader, are having the same problem with sh404SEF and if you’re afraid to apply the above solution by yourself, then please contact us and we’ll do it for you in just one hour and at a very reasonable rate. We promise you you’ll be fully satisfied and we promise you you’ll look forward to working with us again!

2 Responses to “How to Remove the Article ID from the Browser Title in sh404SEF”
  1. Comment by Bob — September 11, 2016 @ 2:19 pm

    Hi,

    Thanks for this info. I’m currently testing this component and had a similar problem. However, when I enable ‘insert ID into URL’ it doesn’t appear in the URL but does in the title.

    So as you’ve explained how to remove it from the title, how can I make it appear in the URL as it should?

    Many thanks!

  2. Comment by Fadi — October 26, 2016 @ 4:24 pm

    Hi Bob,

    Have you tried clearing your Joomla cache after making the change? Most likely this is a caching issue.

Leave a comment