Page 1 of 1

CMSMS and sharing to FB

Posted: Wed Dec 02, 2015 11:02 am
by wmdvanzyl
Hi All..

Right off the bat i will state that i am very green with sharing content to social media.

When i share a post (news article or blog post) to Facebook, the thumbnail doesn't show. I have read that you need to include a tag in the head that looks like this

Code: Select all

<meta property="og:image" content="http://example.com/image.jpg"/>
Now that seems fine, but seeinf as the image in question will be in the news feed or blog, that information is not available to be placed in the head section of the template (obviously).

So how do you get around it? Any advice will be appreciated.

Re: CMSMS and sharing to FB

Posted: Wed Dec 02, 2015 11:40 am
by Jo Morg
CMSMS page templates are parsed in an uncommon order, but one that allows you to solve that a other similar needs:
  1. everything from the start of the template up to the < head > tag;
  2. everything from the < body > tag to the end of the template;
  3. everything between < head > and </ head >;
That allows the use of Smarty variables on the head section that have been set on other sections of the template, including the body and content blocks.

Another way would be to assign the output of the smarty tags to variables on the top of the template, usually right after the {process_pagedata} something like {content assign=mycontent} and then you can use {$mycontent} and the variables already assigned by tag calls made inside of the content or other blocks. There are a few changes to take into account since CMSMS 2+ but they are well documented, so if you do a search on the forum you'll get more info about it.

Re: CMSMS and sharing to FB

Posted: Wed Dec 02, 2015 9:17 pm
by velden
Useful links:

Test your page for Facebook:
https://developers.facebook.com/tools/debug/
Sometimes useful too to refresh an image cached by Facebook.

TIP: use an temporary url for testing.

It's useful to understand how Facebook (or others) determine what to display. What url they will use, image sizes etc.
It occurs to me that while testing 'sharing' it sometimes takes two or three tries before facebook actually displays the image for a 'new' page (that is a page shared for the first time)

Info:
https://developers.facebook.com/docs/sh ... ers#markup

Re: CMSMS and sharing to FB

Posted: Tue Dec 08, 2015 12:19 pm
by wmdvanzyl
I really appreciate the advice. I will begin looking into this asap. :)

Why should i use a temporary URL for testing?