How to make Facebook fetch the article image in XOOPS Publisher module

Date 2015/2/10 2:30:00 | Topic: XOOPS Tips

To make Facebook fetch the correct article image in Publisher, you should add Meta tags to your theme and use a IF statement to make it invisible when on other modules. Add the following between your head tags in your theme:


<{if $xoops_dirname == "Publisher"}> 
        <
link rel="image_src" href="<{$item.image_path}>" /> 
        <
meta property="og:image" content="<{$item.image_path}>"/> 
        <
meta property="og:url" content="<{$item.itemurl}>"/> 
        <
meta itemprop="image" content="<{$item.image_path}>"/> 
        <
link rel="canonical" href="<{$item.itemurl}>"/>  
    <{/if}>


Facebook will use the tag and fetch the correct image. Without it, Facebook will grab any image off your site, and most times it is not relevant to the story.




This article comes from DanorDesign
http://www.danordesign.com

The URL for this article is:
http://www.danordesign.com/modules/AMS/article.php?storyid=3