News:

Support the VirtueMart project and become a member

Main Menu

Include Site Name in Page Titles in browser title

Started by adirz8, November 27, 2016, 22:31:21 PM

Previous topic - Next topic

adirz8

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,

AH

Use the joomla setting in global configuration

seo settings /Include site name in titles

Regards
A

Joomla 3.10.11
php 8.0

adirz8


mcmannehan2002


sandomatyas

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.

AH

VM does not honour this Joomla setting for product/categories etc
Regards
A

Joomla 3.10.11
php 8.0

sandomatyas

And shouldn't it? After all this is a global setting for the whole site

AH

Some people will want it to appear on their category/product pages other people will not.

At the present time - it does not appear
Regards
A

Joomla 3.10.11
php 8.0

GJC Web Design

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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Ventsi Genchev

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.
Audio Store:
https://vsystem.bg - Bulgarian language
https://vsystem.bg/en - English

Ventsi Genchev

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;
    }
}
Audio Store:
https://vsystem.bg - Bulgarian language
https://vsystem.bg/en - English

Typhoon365

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.

jjk

#12
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.
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

AH

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
Regards
A

Joomla 3.10.11
php 8.0