ClearSolid Posted November 26, 2014 Share Posted November 26, 2014 Is there no way to set the meta tag for cms pages so that when sharing to facebook the selected image will show up? <meta og:image/> Link to comment Share on other sites More sharing options...
vekia Posted November 26, 2014 Share Posted November 26, 2014 you want to add the same og:image for each cms page or for each cms page different one? Link to comment Share on other sites More sharing options...
ClearSolid Posted November 26, 2014 Author Share Posted November 26, 2014 (edited) you want to add the same og:image for each cms page or for each cms page different one? If you go http://www.stixnstones.ca/cms/camo <meta property="og:image" content="http://www.stixnstones.ca/img/logo-1.jpg"/> I would like to use whatever the first image of the post is or if there was some way to set it via the CMS that would be great but there isn't Header.tpl {if $page_name=='product'} {if $have_image.0} <meta property="og:image" content="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large_default')}"> {else} <meta property="og:image" content="http://www.stixnstones.ca/img/logo-1.jpg" /> {/if} {else} <meta property="og:image" content="http://www.stixnstones.ca/img/logo-1.jpg" /> {/if} Edited November 26, 2014 by ClearSolid (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted November 26, 2014 Share Posted November 26, 2014 I would like to use whatever the first image of the post is or if there was some way to set it via the CMS that would be great but there isn't It is possible to do but only with js jquery scripts. this mean that it's not good idea to create meta tag "dynamically" with js because facebook crawlers doesnt use js scripts so they will not see these metas. you can achieve it in several ways. for the first, replace striked code with {/if} {if $page_name=='product'} {if $have_image.0} <meta property="og:image" content="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large_default')}"> {else} <meta property="og:image" content="http://www.stixnston.../img/logo-1.jpg" /> {/if} {else} <meta property="og:image" content="http://www.stixnston.../img/logo-1.jpg" /> {/if} you will remove this bad meta tag from other pages than product page free: right below code you mentioned, use code like: {if isset($smarty.get.id_cms)} {if $smarty.get.id_cms==2} <meta property="og:image" content="URL_TO_IMAGE_FOR_CMS_PAGE_WITH_ID=2" /> {elseif $smarty.get.id_cms==3} <meta property="og:image" content="URL_TO_IMAGE_FOR_CMS_PAGE_WITH_ID=3" /> {elseif $smarty.get.id_cms==N} <meta property="og:image" content="URL_TO_IMAGE_FOR_CMS_PAGE_WITH_ID=N" /> {/if} {/if} this code will aply meta tag depending on id of cms you will use 2,3,N where N is any number you want. you can add as many elseif conditions as you want paid if you want feature to manage meta tags from back office you can use htmlboxpro module module allows to create custom content on selected pages, in selected sections (hooks). so, module allows to add <meta> code to HEADER section of shop, on selected CMS pages. you can create as many blocks as you want. example: Link to comment Share on other sites More sharing options...
ClearSolid Posted November 26, 2014 Author Share Posted November 26, 2014 It is possible to do but only with js jquery scripts. this mean that it's not good idea to create meta tag "dynamically" with js because facebook crawlers doesnt use js scripts so they will not see these metas. you can achieve it in several ways. for the first, replace striked code with {/if} you will remove this bad meta tag from other pages than product page free: right below code you mentioned, use code like: {if isset($smarty.get.id_cms)} {if $smarty.get.id_cms==2} <meta property="og:image" content="URL_TO_IMAGE_FOR_CMS_PAGE_WITH_ID=2" /> {elseif $smarty.get.id_cms==3} <meta property="og:image" content="URL_TO_IMAGE_FOR_CMS_PAGE_WITH_ID=3" /> {elseif $smarty.get.id_cms==N} <meta property="og:image" content="URL_TO_IMAGE_FOR_CMS_PAGE_WITH_ID=N" /> {/if} {/if} this code will aply meta tag depending on id of cms you will use 2,3,N where N is any number you want. you can add as many elseif conditions as you want paid if you want feature to manage meta tags from back office you can use htmlboxpro module module allows to create custom content on selected pages, in selected sections (hooks). so, module allows to add <meta> code to HEADER section of shop, on selected CMS pages. you can create as many blocks as you want. example: Wow awesome, did not know about this module - and this paid module removes any uneccessary or duplicate metas like I have now? I think I may grab this module Link to comment Share on other sites More sharing options...
vekia Posted November 26, 2014 Share Posted November 26, 2014 if you will follow this: for the first, replace striked code with {/if} Quote {if $page_name=='product'} {if $have_image.0} <meta property="og:image" content="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large_default')}"> {else} <meta property="og:image" content="http://www.stixnston.../img/logo-1.jpg" /> {/if} {else} <meta property="og:image" content="http://www.stixnston.../img/logo-1.jpg" /> {/if} you will remove this bad meta tag from other pages than product page everything will work well. html box pro module doesnt remove anything, it only creates new contents :-) Link to comment Share on other sites More sharing options...
Recommended Posts