Author Topic: Include Site Name in Page Titles in browser title  (Read 2353 times)

adirz8

  • Beginner
  • *
  • Posts: 11
  • A beginner
Include Site Name in Page Titles in browser title
« on: November 27, 2016, 22:31:21 pm »
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

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2809
  • VirtueMart Version: 3.4
Re: Include Site Name in Page Titles in browser title
« Reply #1 on: November 28, 2016, 09:59:35 am »
Use the joomla setting in global configuration

seo settings /Include site name in titles

regards
A

Joomla 3.8.13
php 7.1

adirz8

  • Beginner
  • *
  • Posts: 11
  • A beginner
Re: Include Site Name in Page Titles in browser title
« Reply #2 on: November 28, 2016, 16:34:34 pm »
it is not working! I try many times.

mcmannehan2002

  • Guest
Re: Include Site Name in Page Titles in browser title
« Reply #3 on: November 28, 2016, 16:42:03 pm »

sandomatyas

  • Jr. Member
  • **
  • Posts: 230
Re: Include Site Name in Page Titles in browser title
« Reply #4 on: September 10, 2018, 15:14:41 pm »
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

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2809
  • VirtueMart Version: 3.4
Re: Include Site Name in Page Titles in browser title
« Reply #5 on: September 10, 2018, 16:07:29 pm »
VM does not honour this Joomla setting for product/categories etc
regards
A

Joomla 3.8.13
php 7.1

sandomatyas

  • Jr. Member
  • **
  • Posts: 230
Re: Include Site Name in Page Titles in browser title
« Reply #6 on: September 12, 2018, 20:30:53 pm »
And shouldn't it? After all this is a global setting for the whole site

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2809
  • VirtueMart Version: 3.4
Re: Include Site Name in Page Titles in browser title
« Reply #7 on: September 13, 2018, 09:25:33 am »
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.8.13
php 7.1

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8395
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.14
Re: Include Site Name in Page Titles in browser title
« Reply #8 on: September 13, 2018, 09:40:22 am »
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 http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Ventsi Genchev

  • Jr. Member
  • **
  • Posts: 211
    • Bulgarian Computer Store
Re: Include Site Name in Page Titles in browser title
« Reply #9 on: September 13, 2018, 10:23:22 am »
For categories:
/templates/your_theme/html/com_virtuemart/category/default.php
For products:
/templates/your_theme/html/com_virtuemart/productdetails/default.php

Code: [Select]
$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.
No pain, no gain, no site!

Ventsi Genchev

  • Jr. Member
  • **
  • Posts: 211
    • Bulgarian Computer Store
Re: Include Site Name in Page Titles in browser title
« Reply #10 on: September 13, 2018, 11:02:18 am »
For categories with main page check (does not add to the main page):
/templates/your_theme/html/com_virtuemart/category/default.php

Code: [Select]
$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;
    }
}
No pain, no gain, no site!

Typhoon365

  • Beginner
  • *
  • Posts: 36
  • VirtueMart Version: 3.2.2
Re: Include Site Name in Page Titles in browser title
« Reply #11 on: September 14, 2018, 08:45:55 am »
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

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3360
  • using Matomo instead of Google Analytics
Re: Include Site Name in Page Titles in browser title
« Reply #12 on: September 15, 2018, 11:33:27 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

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2809
  • VirtueMart Version: 3.4
Re: Include Site Name in Page Titles in browser title
« Reply #13 on: September 15, 2018, 19:35:48 pm »
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.8.13
php 7.1