Sat 12 Jan |
|
Below are some simple hacks to improve your VirtueMart 1.1 metatags especially the html title. Html titles are critical to good search engine visibility and the meta description and meta keywords play a part as well. The standard Virtuemart 1.1. does make an effort to reflect the product in the metatags and html titles but just lists the product name as html title and the site global meta keywords. The product short description is used as the meta description so make sure that is relevant. The standard metatags in our example would be: Virtuemart 2.0 shipping module Postcode - ZIP code and metatags of: website design, Joomla, Templates, web site design, England, Britain, UK But these can be improved with a couple of simple code hacks. Firstly name the categories and if possible the manufacturers with some of your keywords - in my case things like Virtuemart, Joomla, Extensions etc. ![]() This just allows us an easy interface to add the required keywords keywords. Then open file administrator/components/com_virtuemart/html/shop.product_details.php around line 235 and replace this code: // Set Dynamic Page Title if( function_exists('mb_substr')) { $page_title = mb_substr($product_name, 0, 64, vmGetCharset() ); } else { $page_title = substr($product_name, 0, 64 ); } $vm_mainframe->setPageTitle( @html_entity_decode( $page_title, ENT_QUOTES, vmGetCharset() )); // Prepend Product Short Description Meta Tag "description" if( vmIsJoomla('1.5')) { $document = JFactory::getDocument(); $document->setDescription(strip_tags( $db_product->f("product_s_desc"))); } else { $mainframe->prependMetaTag( "description", strip_tags( $db_product->f("product_s_desc")) ); } with // Set Dynamic Page Title//GJC $category_name = $ps_product_category->get_name_by_catid($category_id); $manufacturer_name = $ps_product->get_mf_name($product_id); if( function_exists('mb_substr')) { $page_title = mb_substr($product_name, 0, 128, vmGetCharset() ).'|'.$manufacturer_name.'|'.$category_name; } else { $page_title = substr($product_name, 0, 128 ); } $vm_mainframe->setPageTitle( @html_entity_decode( $page_title, ENT_QUOTES, vmGetCharset() )); // Prepend Product Short Description Meta Tag "description" if( vmIsJoomla('1.5')) { $document = JFactory::getDocument(); $document->setDescription(strip_tags( $db_product->f("product_s_desc"))); $keys = str_replace('|',', ',$page_title); $document->setMetaData("keywords", $keys); } else { $mainframe->prependMetaTag( "description", strip_tags( $db_product->f("product_s_desc")) ); }This will give a html title of: Virtuemart 2.0 shipping module Postcode - ZIP code|Virtuemart 2.0 Plugins|Joomla Downloads and metatags of: Virtuemart 2.0 shipping module Postcode - ZIP code, Virtuemart 2.0 Plugins, Joomla Downloads Much better. This idea can also be extended to the Category page (Browse page in Virtuemart speak) especially if your category description is relatively simple. You could use some string replacement to tidy the title. ![]() Open file administrator/components/com_virtuemart/html/shop.browse.php around line 73. Replace if( $category_id ) { /** * CATEGORY DESCRIPTION */ $db->query( "SELECT category_id, category_name FROM #__{vm}_category WHERE category_id='$category_id'"); $db->next_record(); $category_name = shopMakeHtmlSafe( $db->f('category_name') ); // Set Dynamic Page Title $vm_mainframe->setPageTitle( $db->f("category_name") ); $desc = $ps_product_category->get_description($category_id); $desc = vmCommonHTML::ParseContentByPlugins( $desc ); // Prepend Product Short Description Meta Tag "description" when applicable $mainframe->prependMetaTag( "description", substr(strip_tags($desc ), 0, 255) ); }with if( $category_id ) { /** * CATEGORY DESCRIPTION */ $db->query( "SELECT category_id, category_name FROM #__{vm}_category WHERE category_id='$category_id'"); $db->next_record(); $category_name = shopMakeHtmlSafe( $db->f('category_name') ); // Set Dynamic Page Title $desc = $ps_product_category->get_description($category_id); $desc = str_replace(' & ','|',$desc); $desc = str_replace(' - ','|',$desc); $pagetitle = $desc."|".$db->f("category_name"); $vm_mainframe->setPageTitle( $pagetitle ); $desc = $ps_product_category->get_description($category_id); $desc = vmCommonHTML::ParseContentByPlugins( $desc ); // Prepend Product Short Description Meta Tag "description" when applicable $mainframe->prependMetaTag( "description", substr(strip_tags($desc ), 0, 255) ); $keys = str_replace('|',', ',$pagetitle); $document = JFactory::getDocument(); $document->setMetaData("keywords", $keys); } This will give a html title of: VirtueMart|Joomla plugins|Joomla modules|VirtueMart 2 shipping plugins|Joomla Downloads and metatags of: VirtueMart, Joomla plugins, Joomla modules, VirtueMart 2 shipping plugins, Joomla Downloads |
Last Updated on Saturday, 12 January 2013 13:35 |