Add Open Graph Tags in ISC Homepage, Page and Categories

Problem

By default, the Open Graph tags are missing in ISC Homepage and Categories

Solution

In /public_html/includes/classes/class.index.php

Find

$GLOBALS['ISC_CLASS_TEMPLATE']->SetPageTitle($title);
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("default");
$GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();

Replace

$ogtype = 'website';
$ogtitle = GetConfig('HomePagePageTitle');
$ogdescription = GetConfig('MetaDesc');
$ogimage = 'https://www.moddiy.com/images/logo-1200x630.jpg';
$ogurl = GetConfig('ShopPath');
$GLOBALS['AdditionalMetaTags'] = ISC_OPENGRAPH::getMetaTags($ogtype, $ogtitle, $ogdescription, $ogimage, $ogurl);

$GLOBALS['ISC_CLASS_TEMPLATE']->SetPageTitle($title);
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("default");
$GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();

In /public_html/includes/classes/class.category.php

Find

$GLOBALS['ISC_CLASS_TEMPLATE']->SetCanonicalLink($canonicalLink);
$GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();

Replace

$GLOBALS['ISC_CLASS_TEMPLATE']->SetCanonicalLink($canonicalLink);

$ogtype = 'website';
$ogtitle = $this->BuildTitle();
$ogdescription = 'Buy best quality '.$this->_catname.' from '.GetConfig('StoreName').' with Free Shipping Worldwide!';
$ogimage = 'https://www.moddiy.com/images/logo-1200x630.jpg';
$ogurl = $canonicalLink;
$GLOBALS['AdditionalMetaTags'] = ISC_OPENGRAPH::getMetaTags($ogtype, $ogtitle, $ogdescription, $ogimage, $ogurl);

$GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();

In /includes/classes/class.page.php

Find

$this->_insertOptimizerScripts();

Replace

$ogtype = 'website';
$ogtitle = $this->_pagetitle;
$ogdescription = $this->_pagetitle ." - ".GetConfig('StoreName');
$ogimage = GetConfig('ShopPath').'/images/logo-1200x630.jpg';
$ogurl = PageLink($this->_pageid,$this->_pagetitle);
$GLOBALS['AdditionalMetaTags'] = ISC_OPENGRAPH::getMetaTags($ogtype, $ogtitle, $ogdescription, $ogimage, $ogurl);

$this->_insertOptimizerScripts();

Remark

The best Open Graph image size is 1200 x 630 where visible content in the image should be within 630 x 630

Reference: https://iamturns.com/open-graph-image-size/

Result

<meta property="og:type" content="website" />
<meta property="og:title" content="modDIY Home Page - PC Modding, Case Mods, Custom Cables" />
<meta property="og:description" content="Best selection of PC mod supplies offers custom pc cable, case mods, computer cooling systems, computer case mod DIY parts, wire management kits, custom pc mods" />
<meta property="og:image" content="https://www.moddiy.com/images/logo-1200x630.jpg" />
<meta property="og:url" content="https://www.moddiy.com" />
<meta property="og:site_name" content="modDIY.com" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Cable Sleeving - modDIY.com" />
<meta property="og:description" content="Browse all Cable Sleeving products from modDIY.com" />
<meta property="og:image" content="https://www.moddiy.com/images/logo-1200x630.jpg" />
<meta property="og:url" content="https://www.moddiy.com/categories/Cable-Sleeving/" />
<meta property="og:site_name" content="modDIY.com" />

Leave a Reply

Your email address will not be published. Required fields are marked *