Support > General

Article in category no site name added in page title [solved]

(1/2) > >>

kyomar:
Hi, I just noticed that when I open an article belonging to a category the site name is not added at the end of the page title.
Example:
- article no category; page title = article title - site name
- category; page title = category title - site name
- article within category; page title = article title - category title - (empty - no site name)
Is this by design? How can I add site name? I am using Elxis 5 and five template.

Thank you!

webgift:

As far as i can see sitename is added when we have articles without category (autonomous
articles). You could apply the following change:

File: components/com_content/controllers/article.php
Line: 146

Change the following line:
$eDoc->setTitle($row->title.' - '.$category_title.$page_extra);

to:
$eDoc->setTitle($row->title.' - '.$category_title.$page_extra.' - '.$elxis->getConfig('SITENAME'));

Take under consideration that sitename should contain up to 70 characters in length.

kyomar:
Thanks a lot webgift; changed the code and all good. I think the sitename should always be added.

I have just noticed that the category title resp. sitename is added to the description, which doesn't make sense to me. Do I have to change these lines:
if ($category_title != '') { $eDoc->setDescription($desc.' '.$category_title.$page_extra); }
else { $eDoc->setDescription($desc.$page_extra.' '.$elxis->getConfig('SITENAME')); }

to this:
if ($category_title != '') { $eDoc->setDescription($desc); }
else { $eDoc->setDescription($desc.$page_extra)); }

Thank you!

webgift:

You're welcome!
If you need the sitename then you should add the following line 
$elxis->getConfig('SITENAME'));
in both cases.

It's nice to separate the meta description when you have a category_title or not. So
it's up to your desire!

kyomar:
Thanks webgift. I don't need the sitename or category title after meta description like in the attached screenshot. I am sorry but I am still not sure whether the code change I suggested is correct to remove sitename/category title? Would be great if you could verify.
Thank you!

Navigation

[0] Message Index

[#] Next page

Go to full version