Announcement

Collapse
No announcement yet.

Share and Facebook Like Header og tags

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Share and Facebook Like Header og tags

    Having gone through various posts on this subject I came up with this, posted without warranty in case it is found to be useful.

    Go to http://sharethis.com/publishers/get-sharing-tools and get the buttons, you will get code for the bottom of the page and code for where you want the buttons. You can sign in with your Google account.

    Two ways to do it:

    Number one.

    Place the buttons in the product layout so people can like each product. Seems to work best with one product per section.

    Put this at the bottom of the page before the analytics code:
    Code:
    <actinic:block if="%3cactinic%3avariable%20name%3d%22IsPreviewMode%22%20%2f%3e%20%3d%3d%20False">
    <script type="text/javascript">var switchTo5x=true;</script>
    <script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
    <script type="text/javascript">stLight.options({publisher: "your-long-code-number-here"}); </script>
    </actinic:block>
    Put this in the product layout:
    Code:
    <span class='st_sharethis'></span><span class='st_facebook'></span><span class='st_twitter'><span class='st_googleplus'></span></span><span class='st_linkedin'></span><span class='st_email'></span><span class='st_fblike'></span>
    Put this in the <head></head> area:
    Code:
    <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Section%22" >
    	<actinic:block type="ProductList" />
    		<actinic:block if="%3cactinic%3avariable%20name%3d%22ListIndex%22%20%2f%3e%20%3d%3d%201">
    			<meta property="og:title" content="<actinic:variable encoding="strip" name="PageTitle" />" />
    			<meta property="og:type" content="product" />
    			<script type="text/javascript">
    			document.write ('<meta property="og:url" content="'+window.location+'" />');
    			</script>			
    <actinic:block if="%3cactinic%3avariable%20name%3d%22ProductImageFileName%22%20%2f%3e%20%21%3d%20%22%22">
    <meta property="og:image" content="<actinic:variable name="CatalogURL" /><actinic:block php="true" >$path_parts = pathinfo('<actinic:variable name="ProductImageFileName" encoding="perl" selectable="false" />');echo $path_parts['basename'], "\n";</actinic:block>" />
    </actinic:block>
    			<meta property="og:site_name" content="Like Button Test" />
    			<meta property="fb:admins" content="your-facebook-id-number" />
    		</actinic:block>
    	</actinic:block>
    </actinic:block>
    Number Two

    The buttons go at the top of each website page, in which case the header tags need to be different for brochure, section and product pages.

    Again, this goes at the bottom of the page before the analytics code:
    Code:
    <actinic:block if="%3cactinic%3avariable%20name%3d%22IsPreviewMode%22%20%2f%3e%20%3d%3d%20False">
    <script type="text/javascript">var switchTo5x=true;</script>
    <script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
    <script type="text/javascript">stLight.options({publisher: "your-long-code-number-here"}); </script>
    </actinic:block>
    This goes at the top of the page outer layout somewhere:
    Code:
    <div style="padding-top:5px;float:right;"><span class='st_sharethis'></span><span class='st_facebook'></span><span class='st_twitter'><span class='st_googleplus'></span></span><span class='st_linkedin'></span><span class='st_email'></span><span class='st_fblike'></span></div>
    This goes in the <head></head> area:
    Code:
    <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Brochure%22" >
    <!--*brochure-->
    <meta property="og:title" content="<actinic:variable name="CompanyName" /> <actinic:variable encoding="strip" name="PageTitle" />" />
    			<meta property="og:type" content="product" />
    			<script type="text/javascript">
    			document.write ('<meta property="og:url" content="'+window.location+'" />');
    			</script>			
    
    <meta property="og:image" content="<actinic:variable name="CatalogURL" /><actinic:variable name="CompanyLogoFileName" />" />
    
    			<meta property="og:site_name" content="Like Button Test" />
    			<meta property="fb:admins" content="your-facebook-id-number" />
    			<meta property="og:description" content="<actinic:block if="%3cactinic%3avariable%20name%3d%22MetaDescription%22%20%2f%3e%20%21%3d%20%22%22" ><actinic:variable name="MetaDescription" /></actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22MetaDescription%22%20%2f%3e%20%3d%3d%20%22%22" ><actinic:variable name="GlbMetaDescription" /></actinic:block>" />
    </actinic:block>
    <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Section%22" >
    <!--*section-->
    
    			<meta property="og:title" content="<actinic:variable name="SectionName" />" />
    			<meta property="og:type" content="product" />
    			<script type="text/javascript">
    			document.write ('<meta property="og:url" content="'+window.location+'" />');
    			</script>			
    
    <meta property="og:image" content="<actinic:variable name="CatalogURL" /><actinic:block php="true" >$path_parts = pathinfo('<actinic:variable name="SectionImageFileName" />');echo $path_parts['basename'], "\n";</actinic:block>" />
    
    			<meta property="og:site_name" content="Like Button Test" />
    			<meta property="fb:admins" content="your-facebook-id-number" />
    			<meta property="og:description" content="<actinic:block if="%3cactinic%3avariable%20name%3d%22SectionDescription%22%20%2f%3e%20%21%3d%20%22%22" ><actinic:variable name="SectionDescription" /></actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22MetaDescription%22%20%2f%3e%20%21%3d%20%22%22%20%20AND%20%3cactinic%3avariable%20name%3d%22SectionDescription%22%20%2f%3e%20%3d%3d%20%22%22" ><actinic:variable name="MetaDescription" /></actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22MetaDescription%22%20%2f%3e%20%3d%3d%20%22%22%20%20AND%20%3cactinic%3avariable%20name%3d%22SectionDescription%22%20%2f%3e%20%3d%3d%20%22%22" ><actinic:variable name="GlbMetaDescription" /></actinic:block>" />
    		
    </actinic:block>
    <actinic:block if="%28%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Product%20Page%22%29" >
    <!--*product page-->
    
    			<meta property="og:title" content="<Actinic:Variable Name="ProductName"/>" />
    			<meta property="og:type" content="product" />
    			<script type="text/javascript">
    			document.write ('<meta property="og:url" content="'+window.location+'" />');
    			</script>			
    <actinic:block if="%3cactinic%3avariable%20name%3d%22ProductImageFileName%22%20%2f%3e%20%21%3d%20%22%22">
    <meta property="og:image" content="<actinic:variable name="CatalogURL" /><actinic:block php="true" >$path_parts = pathinfo('<actinic:variable name="ProductImageFileName" encoding="perl" selectable="false" />');echo $path_parts['basename'], "\n";</actinic:block>" />
    </actinic:block>
    			<meta property="og:site_name" content="Like Button Test" />
    			<meta property="fb:admins" content="your-facebook-id-number" />
    			<meta property="og:description" content="<actinic:block if="%3cactinic%3avariable%20name%3d%22ProductDescription%22%20%2f%3e%20%21%3d%20%22%22"><actinic:variable name="ProductDescription" /></actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22ProductPageMetaDescription%22%20%2f%3e%20%21%3d%20%22%22%20%20AND%20%3cactinic%3avariable%20name%3d%22ProductDescription%22%20%2f%3e%20%3d%3d%20%22%22" ><actinic:variable name="ProductPageMetaDescription" /></actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22ProductPageMetaDescription%22%20%2f%3e%20%3d%3d%20%22%22%20%20AND%20%3cactinic%3avariable%20name%3d%22ProductDescription%22%20%2f%3e%20%3d%3d%20%22%22" ><actinic:variable name="GlbMetaDescription" /></actinic:block>" />
    </actinic:block>
    It seems to work, no doubt people can correct, adapt and evolve it.

    Thanks
    Jonathan Chappell
    Website Designer
    SellerDeck Website Designer
    Actinic to SellerDeck upgrades
    Graphicz Limited - www.graphicz.co.uk

    #2
    Hi Jonathan, thank you for this which I am currently trying to implement on my site. I am experiencing a problem though - sometimes the correct image is picked, sometimes an incorrect image is picked, and sometimes no image at all gets included! My desired location for the buttons is on each of my individual product pages and I am following method 1) above.

    I have the following code at the top of my 'Full Width Header & Two Sidebars' page (just before the closing </head> tag):-

    Code:
    <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Section%22" >
    	<actinic:block type="ProductList" />
    		<actinic:block if="%3cactinic%3avariable%20name%3d%22ListIndex%22%20%2f%3e%20%3d%3d%201">
    			<meta property="og:title" content="<actinic:variable encoding="strip" name="PageTitle" />" />
    			<meta property="og:type" content="product" />
    			<script type="text/javascript">
    			document.write ('<meta property="og:url" content="'+window.location+'" />');
    			</script>			
    <actinic:block if="%3cactinic%3avariable%20name%3d%22ProductImageFileName%22%20%2f%3e%20%21%3d%20%22%22">
    <meta property="og:image" content="<actinic:variable name="CatalogURL" /><actinic:block php="true" >$path_parts = pathinfo('<actinic:variable name="ProductImageFileName" encoding="perl" selectable="false" />');echo $path_parts['basename'], "\n";</actinic:block>" />
    </actinic:block>
    			<meta property="og:site_name" content="Ouch! Body Jewellery" />
    			<meta property="fb:admins" content="xxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
    		</actinic:block>
    	</actinic:block>
    </actinic:block>
    I have the following code at the bottom of my 'Full Width Header & Two Sidebars' page (just before the Analytics code):-

    Code:
    <script type="text/javascript">var switchTo5x=true;</script>
    <script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
    <script type="text/javascript">stLight.options({publisher: "xxxxxxxxxxxxxxxxxxxxxxxxx", doNotHash: false, doNotCopy: false, hashAddressBar: false});</script>
    and finally I have the following code in my 'Standard Layout Using CSS - Tabbed Descriptions':-

    Code:
    <span class='st_facebook_large' displayText='Facebook'></span>
    <span class='st_twitter_large' displayText='Tweet'></span>
    <span class='st_pinterest_large' displayText='Pinterest'></span>
    <span class='st_email_large' displayText='Email'></span>
    Example 1 includes the correct image.

    Example 2 includes the wrong image.

    I was about to include an Example 3 (which wasn't including any image), however at that point I noticed that if I closed the Share window down and then clicked the Facebook button again, it did include the image the second time around. I can't seem to pinpoint any consistency with this though, because it is looking like no matter how many times I open a new Share window, it seems to be hit and miss as to whether I am shown the correct image, the wrong image or no image.

    I have just come across Facebook's Object Debugger and when I put my site in, the debugger gives me four warnings in there regarding 'Inferred Property'.

    So - it all seems quite random as to whether the Share window displays the correct image or not. Or even one at all!

    I just wondered whether yourself (or anybody else) has seen this type of problem before? Or would have any idea of how I could amend my code to ensure that the correct image is displayed at all times please?

    Comment


      #3
      See: http://community.sellerdeck.com/showthread.php?t=55241
      Peblaco

      Comment


        #4
        Thank you Louise - I did see that thread but it all looked a bit complicated last night (although my eyes were a bit tired at the time). I'll have another look now and try to work through it.

        Talking of AddThis, I would prefer to use their buttons but I can't even get them to display at the moment, which is strange because I managed it with no problems last year (I only took them off because of this problem with the incorrect images being displayed).

        Comment

        Working...
        X