QuotesUK Posted June 15, 2015 Share Posted June 15, 2015 Does anyone know if there is a plugin to manage additional meta tag insertion?I would like to add Facebook OG meta tags to my v6 CubeCart installation but I would prefer to manage via a plugin, rather than hack the template, so that I know that future upgrades can replace the template code without affecting my extra code.Ideally the plugin needs to just insert whatever text is entered into the HTML header before the closing head markup.Similar plugin functionality is available for Wordpress. Quote Link to comment Share on other sites More sharing options...
bsmither Posted June 15, 2015 Share Posted June 15, 2015 You may create your own Code Snippet to load javascript into the <head> section of the page. The trigger to use is: class.gui.head_js.The PHP code for the snippet will be adding an element to the $head_js array which will be a string that is either a <script src=""> tag to a script file, or code in a <script> tag, complete with the tags.Although, there is no absolute requirement that the snippet be adding <script> tags. You can certainly be adding <meta> tags - no problem.The template must have this in the <head> section (Foundation already does, and Foundation already has the FBOG meta tags if FBOG is enabled):{foreach from=$HEAD_JS item=js}{$js}{/foreach} Quote Link to comment Share on other sites More sharing options...
QuotesUK Posted June 15, 2015 Author Share Posted June 15, 2015 Thank you. I understand the concept but not the practicalities.Where do I make the edit, or place the files?Could it be replaced during upgrades? If it can, then I might as well just hack the skin template (Kurouto). Quote Link to comment Share on other sites More sharing options...
bsmither Posted June 15, 2015 Share Posted June 15, 2015 Kurouto already has these lines in the <head> section: {if $FBOG} <meta property="og:image" content="{$PRODUCT.thumbnail}"> <meta property="og:url" content="{$VAL_SELF}"> {/if} To have them be populated with data, you will need to enable either the "Facebook" social module, or the "AddThis" social module. Quote Link to comment Share on other sites More sharing options...
QuotesUK Posted June 15, 2015 Author Share Posted June 15, 2015 I have the AddThis social module enabled.However there are serious shortcomings.Firstly, the OG tags aren't inserted on the home page (because AddThis is only enabled for product pages)Secondly, on product pages it uses the cached thumbnail as the OG:Image source, which fails Facebook’s minimum dimension sizes.So instead of the product image, which needs to be a minimum of 200x200px, it grabs the store logo, and crops it badlyAlso, description and title OG tags are missingIt looks like I'm going to have to hack out that code and replace with boilerplate that works Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted June 15, 2015 Share Posted June 15, 2015 Secondly, on product pages it uses the cached thumbnail as the OG:Image source, which fails Facebook’s minimum dimension sizes.So instead of the product image, which needs to be a minimum of 200x200px, it grabs the store logo, and crops it badlySo THAT'S why I haven't been able to get our store images to show on FB! I get our SSL Comodo pic instead. I use AddThis as well and would really appreciate help fixing this.Facebook Developer Lint tool Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted June 15, 2015 Share Posted June 15, 2015 @QuotesUKWith your suggestion that it was the thumbnail that was the issue, I changed the code in main.php to<meta property="og:image" content="{$image.source}">And for the first time since switching to Foundation, I was able to get a product listing to correctly display on Facebook!!! Yeah! And THANK YOU!!! YIKES!! It does work correctly on my own personal Facebook page, but it still shows the SSL picture when the same product is listed on my store Facebook page. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.