Author Topic: Include Site Name in Page Titles  (Read 3526 times)

leFlea

  • Beginner
  • *
  • Posts: 19
Include Site Name in Page Titles
« on: October 14, 2012, 15:55:46 pm »
Is there a hack or fix for including site name in page titles?

Joomla 2.5 has a new global setting for "Include Site Name in Page Titles". Can be set to Before or After or No. This doesn't work in VM2.0.12b.
e.g. When viewing category page instead of just showing category name on page title: "Furniture" would like it to be "Furniture - Hacienda Crafts Co."

cmb

  • Jr. Member
  • **
  • Posts: 85
Re: Include Site Name in Page Titles
« Reply #1 on: November 03, 2012, 19:24:13 pm »
It doesn't work in VirtueMart version 2.0.12f either.
Joomla 2.5.7
Charles

CE WebDesign München

  • Jr. Member
  • **
  • Posts: 112
  • CE WebDesign München
    • CE WebDesign München
Re: Include Site Name in Page Titles
« Reply #2 on: December 07, 2012, 13:10:36 pm »
hi, for VM 2.0.14:)
FOR CATEGORY:
\components\com_virtuemart\views\category\view.html.php (LINE 188)
REPLACE:
      $document->setTitle( $title );
WITH:
      $document->setTitle(JFactory::getApplication()->getCfg('sitename').' -> '.$title);
      
FOR PRODUCTS:
\components\com_virtuemart\views\productdetails\view.html.php (LINE 213)
REPLACE:
      $document->setTitle( strip_tags(($category->category_name?($category->category_name.' - '):'').$product->product_name));
WITH:
       $document->setTitle(JFactory::getApplication()->getCfg('sitename').' -> '.strip_tags(($category->category_name ? ($category->category_name . ' -> '): '') . $product->product_name));
      
      
if you want to do it without hack, edit:
Category->Product Category Form->Meta Information->Custom Page Title
Product->Product Description->Meta Information->Custom Page Title
CE WebDesign München: https://ce-webdesign.de | Websites, eCommerce WebShops | Responsive Design | SEO

dblaze

  • Beginner
  • *
  • Posts: 5
Re: Include Site Name in Page Titles
« Reply #3 on: September 29, 2013, 17:07:43 pm »
Or more fancyer way, u mkae template overrides and include all options.... just put this in every default.php template ur using (category, productdetails, etc.)
Code: [Select]
/* BEGIN Virtuemart Title Fix */
$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;
    }
}
/* END Virtuemart Title Fix */
2b || !2b; this.question();
http://www.dblaze.eu

CE WebDesign München

  • Jr. Member
  • **
  • Posts: 112
  • CE WebDesign München
    • CE WebDesign München
Re: Include Site Name in Page Titles
« Reply #4 on: September 29, 2013, 19:19:56 pm »
hi dblaze, works for me,
thank you very much for sharing this, really helpfull!!!   8)
CE WebDesign München: https://ce-webdesign.de | Websites, eCommerce WebShops | Responsive Design | SEO