Jump to content

Additional Meta Tag Insertion


QuotesUK

Recommended Posts

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.

Link to comment
Share on other sites

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}

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 badly

Also, description and title OG tags are missing

It looks like I'm going to have to hack out that code and replace with boilerplate that works

Link to comment
Share on other sites

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 badly

So 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

Link to comment
Share on other sites

@QuotesUK

With 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. :(

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...