Welcome,
Guest
.
Please
login
or
register
.
Did you miss your
activation email
?
News:
Bug reports and fixes
.
Home
Help
Login
Register
Elxis CMS Forum
»
Support
»
General
(Moderators:
Ivan Trebješanin
,
Farhad Sakhaei
) »
Article in category no site name added in page title [solved]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Article in category no site name added in page title [solved] (Read 4864 times)
kyomar
Full Member
Posts: 158
Article in category no site name added in page title [solved]
«
on:
September 14, 2019, 05:29:51 »
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!
«
Last Edit: September 27, 2019, 01:04:23 by kyomar
»
Logged
webgift
Elxis Team
Hero Member
Posts: 4193
Re: Article in category no site name added in page title
«
Reply #1 on:
September 23, 2019, 16:34:13 »
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.
Logged
Elxis Team •
Custom web design [EN]
-
[EL]
•
.GR Registrar
kyomar
Full Member
Posts: 158
Re: Article in category no site name added in page title
«
Reply #2 on:
September 24, 2019, 10:45:42 »
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!
Logged
webgift
Elxis Team
Hero Member
Posts: 4193
Re: Article in category no site name added in page title
«
Reply #3 on:
September 24, 2019, 20:43:00 »
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!
Logged
Elxis Team •
Custom web design [EN]
-
[EL]
•
.GR Registrar
kyomar
Full Member
Posts: 158
Re: Article in category no site name added in page title
«
Reply #4 on:
September 25, 2019, 10:27:06 »
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!
Logged
webgift
Elxis Team
Hero Member
Posts: 4193
Re: Article in category no site name added in page title
«
Reply #5 on:
September 26, 2019, 11:59:49 »
We're talking about Meta Title and it's been changed to Description.
In case that you would like to remove these from Meta Description tag then you should
change the following:
if (
$category_title
!=
''
) {
$eDoc
->
setDescription
(
$desc
.
' '
.
$category_title
.
$page_extra
);
} else {
$eDoc
->
setDescription
(
$desc
.
$page_extra
.
' '
.
$elxis
->
getConfig
(
'SITENAME'
));
}
With these one:
/* if ($category_title != '') {
$eDoc->setDescription($desc.' '.$category_title.$page_extra);
} else {
$eDoc->setDescription($desc.$page_extra.' '.$elxis->getConfig('SITENAME'));
}*/
$eDoc
->
setDescription
(
$desc
.
' '
.
$page_extra
);
page_extra is required in order to separate the Meta Description within pages.
Category title would be nice to keep if you would like my opinion.
Logged
Elxis Team •
Custom web design [EN]
-
[EL]
•
.GR Registrar
kyomar
Full Member
Posts: 158
Re: Article in category no site name added in page title
«
Reply #6 on:
September 26, 2019, 12:31:24 »
Many thanks webgift for the correct code and I am sorry for the confusion changing the subject from Meta Title to Meta Description. Anyhow, I really don' t understand why you think it's nice to have Category or Sitename added to the description. I don't see the benefit and the category title and sitename are already shown in the Page Title. I guess I am missing something :-).
Thanks again and have a nice day!
Logged
webgift
Elxis Team
Hero Member
Posts: 4193
Re: Article in category no site name added in page title [solved]
«
Reply #7 on:
September 27, 2019, 09:05:11 »
You're welcome @kyomar
More data in Meta tag could be used mainly for two reasons:
We have too short Meta tag.
We have the same Meta tag with another page.
Logged
Elxis Team •
Custom web design [EN]
-
[EL]
•
.GR Registrar
Print
Pages: [
1
]
« previous
next »
Elxis CMS Forum
»
Support
»
General
(Moderators:
Ivan Trebješanin
,
Farhad Sakhaei
) »
Article in category no site name added in page title [solved]