-
AuthorPosts
-
cyrusxxx Friend
cyrusxxx
- Join date:
- July 2014
- Posts:
- 42
- Downloads:
- 11
- Uploads:
- 10
- Thanks:
- 18
- Thanked:
- 4 times in 4 posts
November 28, 2017 at 1:07 am #1077157Hello I have one question concerning open graph tags.
I have implemented Facebook open graph tags for my articles creating template override and inserting this code:
[code]//opengraph
if (isset($images->image_intro) and !empty($images->image_intro))
{
$timage= htmlspecialchars(JURI::root().$images->image_intro);}
elseif (isset($images->image_fulltext) and !empty($images->image_fulltext))
{
$timage= htmlspecialchars(JURI::root().$images->image_fulltext);
}
else
{
$timage= ‘https://xxxxx.jpg‘;
}
$doc =& JFactory::getDocument();
$doc->addCustomTag( ‘<meta name="twitter:title" content="’.$this->escape($this->item->title).’">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@xxxxxxx">
<meta name="twitter:creator" content="@xxxxxxxxx">
<meta name="twitter:url" content="’.str_replace(‘" ‘,’"’,JURI::current()).’"="">
<meta name="twitter:description" content="’.strip_tags($this->item->introtext).’">
<meta name="twitter:image" content="’.$timage.’">
<meta property="og:title" content="’.$this->escape($this->item->title).’"/>
<meta property="og:type" content="article"/>
<meta property="og:email" content="xxxxxxxxxx";/>
<meta property="og:url" content="’.str_replace(‘" ‘,’"’,juri::current()).’"="">
<meta property="og:image" content="’.$timage.’"/>
<meta property="og:site_name" content="xxxxxxxxxx"/>
<meta property="fb:admins" content="xxxxxxxx"/>
<meta property="og:locale" content="xxxxxx" />
<meta property="og:description" content="’.strip_tags($this->item->introtext).’"/>
‘);
?>[/code]and with this code article meta is displayed properly.
But now if I insert in meta property image for main domain in template head section that image overrides article image set in default.php template override.Can anyone tell me how to set open graph image for main domain and not to override articles image when shared?
Thank you!
Pankaj Sharma ModeratorPankaj Sharma
- Join date:
- February 2015
- Posts:
- 24589
- Downloads:
- 144
- Uploads:
- 202
- Thanks:
- 127
- Thanked:
- 4196 times in 4019 posts
November 28, 2017 at 2:54 am #1077217Hi
head files is same for all the site pages, In case you want to apply the meta to specific layout you have to use PHP if else statement to define to code for a particular menu id or you can define them on the layout files, for example, category blog file override will be in the template folder /html/com_content/category .Regards
1 user says Thank You to Pankaj Sharma for this useful post
cyrusxxx Friendcyrusxxx
- Join date:
- July 2014
- Posts:
- 42
- Downloads:
- 11
- Uploads:
- 10
- Thanks:
- 18
- Thanked:
- 4 times in 4 posts
November 28, 2017 at 4:42 am #1077240I see now, same thing just for other overrides.
But in category blog override I think if else is not needed because there is no intro and full article image.Thank you very much Pankraj for clarifying this to me.
Pankaj Sharma ModeratorPankaj Sharma
- Join date:
- February 2015
- Posts:
- 24589
- Downloads:
- 144
- Uploads:
- 202
- Thanks:
- 127
- Thanked:
- 4196 times in 4019 posts
-
AuthorPosts
This topic contains 3 replies, has 2 voices, and was last updated by Pankaj Sharma 6 years, 11 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum