Hi , How I can Include my site name in page title
like" page title - site name".
it is only pages of virtuemart.
site url: http://www.thedealers.co.il/
VirtueMart 3.0.18, Joomla! 3.6.4.
Thanks,
Use the joomla setting in global configuration
seo settings /Include site name in titles
it is not working! I try many times.
May be this should help:
https://docs.joomla.org/J3.x:Global_configuration (https://docs.joomla.org/J3.x:Global_configuration)
It's still doesn't work. When I enable "Site Name in Page Titles" it works everywhere except with VirtueMart which just ignores this setting.
VM does not honour this Joomla setting for product/categories etc
And shouldn't it? After all this is a global setting for the whole site
Some people will want it to appear on their category/product pages other people will not.
At the present time - it does not appear
It would be a relatively small task to append the site name to the existing Html title.. u could do it in the template over rides
something like
$document = JFactory::getDocument();
$title = $document->getTitle;
$config = JFactory::getConfig();
$sitename = $config->get( 'sitename' );
$document->setTitle($sitename.' | '.$title);
not tried or tested
For categories:
/templates/your_theme/html/com_virtuemart/category/default.php
For products:
/templates/your_theme/html/com_virtuemart/productdetails/default.php
$includeSiteName = (int) JFactory::getApplication()->getCfg('sitename_pagetitles');
if ($includeSiteName) {
$document = JFactory::getDocument();
$siteName = JFactory::getApplication()->getCfg('sitename');
$docTitle = $document->getTitle();
switch ($includeSiteName) {
case 1;
$document->setTitle($siteName . ' - ' . $docTitle);
break;
case 2;
$document->setTitle($docTitle . ' - ' . $siteName);
break;
}
}
Tested and worked.
If the main page is a category, an ID check must be done to avoid duplicating the site name.
For categories with main page check (does not add to the main page):
/templates/your_theme/html/com_virtuemart/category/default.php
$includeSiteName = (int) JFactory::getApplication()->getCfg('sitename_pagetitles');
$category_id = vRequest::getInt ('virtuemart_category_id', 0);
if ($includeSiteName && $category_id !=0) {
$document = JFactory::getDocument();
$siteName = JFactory::getApplication()->getCfg('sitename');
$docTitle = $document->getTitle();
switch ($includeSiteName) {
case 1;
$document->setTitle($siteName . ' - ' . $docTitle);
break;
case 2;
$document->setTitle($docTitle . ' - ' . $siteName);
break;
}
}
Would love this to be incorporated into the core code.
Seems quite a few of us need site name in our page titles.
Understand we can do it as an override, but having overrides for basic functionality like this is a pain. Everytime we do a Virtuemart and 3rd template update to get the latest, we need to re-implement again.
Quote from: Typhoon365 on September 14, 2018, 08:45:55 AM
Seems quite a few of us need site name in our page titles.
I'm using an override which adds the manufacturer name into the browser page title of product views. Anyway, whatever you add, take into consideration that Google cuts off the title after 70 characters (often less, depending on the width of characters in the title). In case that you add the site name in front, the product name (keywords) moves towards the end of the line, which might result in lower ranking and also the displayed product name might become truncated in Google search results. Another disadvantage with the site name in front of the browser page title is, that all open browser tabs might show only site name and the user can see the rest only if he places his mouse pointer over the tab.
I use an override for the category page titles to include the sitename - very similar to @GJC version
But slightly different using category name | sitename