Download all Joomla templates including quickstart (demo)only $24.99

Forum

Important - Hands Up!

- Please ask using the account with which you made the purchase or download of our products and in its respective category.
- If you bought our products in another market, ask your questions in that market, not here.

* ADD PRODUCT NAME IN START OF SUBJET

SOMBRA - Add category to page title

  • J
  • jeromebg New Member
  • Topic Author 4 weeks 1 day ago #1
Hi,
Is there a way to add the categoy name before or after the article title in the meta <title></title> of the document ?
By default the document titlte is <title>Article title</title> and I would like to have <title>Categoy of the article | Article title</title>
Thank you

Please Log in or Create an account to join the conversation.

  • L
  • leoalv Moderator
  • 4 weeks 1 day ago #2
Hello.
The way to add the category name to the Joomla article title would be by creating an override, and manipulating the existing meta tags to replace it with a new one. It requires programming knowledge.

Perhaps in the Joomla extensions directory there is a plugin that allows you to add custom meta tags.

In both cases I think they would have an additional cost with respect to performance.

Please Log in or Create an account to join the conversation.

  • J
  • jeromebg New Member
  • Topic Author 4 weeks 1 day ago #3
Ok thank you.
Can you tell me what file generates the meta tags ?

Please Log in or Create an account to join the conversation.

  • L
  • leoalv Moderator
  • 4 weeks 1 day ago #4
Or you could add a Custom title to each article from the Options tab in the Browser Page Title field, where you would add the category name and the article title, in any order you like.

Please Log in or Create an account to join the conversation.

  • L
  • leoalv Moderator
  • 4 weeks 1 day ago #5
If you want to add the category to the Joomla article title automatically, consider creating or duplicating our override either ublog.php or portfolio.php which is located in templates/ut_sombra/html/com_content/article
just before the first php close ?> add the following php code:
Code:
$document = Factory::getDocument(); $cateTitle = $this->item->category_title; $artTitle = $this->item->title; $document->setTitle($cateTitle.' | '.$artTitle);

Enjoy, regards
 

Please Log in or Create an account to join the conversation.

  • J
  • jeromebg New Member
  • Topic Author 4 weeks 1 day ago #6
Thank you, works perfect !
And if I want to add the main category of the category is it possible ?

Please Log in or Create an account to join the conversation.

  • L
  • leoalv Moderator
  • 4 weeks 23 hours ago #7
Yes, add these variable
Code:
$parentTitle = $this->item->parent_title;
 Then you can concatenate
Code:
$document->setTitle($parentTitle.' | '.$cateTitle.' | '.$artTitle);

Regards
The following user(s) said Thank You: jeromebg

Please Log in or Create an account to join the conversation.

  • J
  • jeromebg New Member
  • Topic Author 3 weeks 5 days ago #8
Works perfect, thank you very much !

Please Log in or Create an account to join the conversation.