mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 20:00:37 +02:00
Fix for overloading FB with too many og:image meta tags.
This commit is contained in:
40
news.php
40
news.php
@@ -1123,22 +1123,7 @@ function setNewsFrontMeta($news, $type='news')
|
|||||||
e107::meta('og:description',$news['news_summary']);
|
e107::meta('og:description',$news['news_summary']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// grab all images in news-body and add to meta.
|
// include news-thumbnail/image in meta. - always put this one first.
|
||||||
$images = e107::getBB()->getContent('img',$news['news_body'],SITEURL.e_IMAGE."newspost_images/");
|
|
||||||
foreach($images as $im)
|
|
||||||
{
|
|
||||||
e107::meta('og:image',$im);
|
|
||||||
}
|
|
||||||
|
|
||||||
// grab all youtube videos in news-body and add thumbnails to meta.
|
|
||||||
$youtube = e107::getBB()->getContent('youtube',$news['news_body']);
|
|
||||||
foreach($youtube as $yt)
|
|
||||||
{
|
|
||||||
list($img,$tmp) = explode("?",$yt);
|
|
||||||
e107::meta('og:image',"http://img.youtube.com/vi/".$img."/0.jpg");
|
|
||||||
}
|
|
||||||
|
|
||||||
// include news-thumbnail/image in meta.
|
|
||||||
if($news['news_thumbnail'])
|
if($news['news_thumbnail'])
|
||||||
{
|
{
|
||||||
$iurl = (substr($news['news_thumbnail'],0,3)=="{e_") ? $news['news_thumbnail'] : SITEURL.e_IMAGE."newspost_images/".$news['news_thumbnail'];
|
$iurl = (substr($news['news_thumbnail'],0,3)=="{e_") ? $news['news_thumbnail'] : SITEURL.e_IMAGE."newspost_images/".$news['news_thumbnail'];
|
||||||
@@ -1155,6 +1140,29 @@ function setNewsFrontMeta($news, $type='news')
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// grab all images in news-body and add to meta.
|
||||||
|
$images = e107::getBB()->getContent('img',$news['news_body'],SITEURL.e_IMAGE."newspost_images/");
|
||||||
|
$c =1;
|
||||||
|
foreach($images as $im)
|
||||||
|
{
|
||||||
|
if($c == 4){ break; }
|
||||||
|
e107::meta('og:image',$im);
|
||||||
|
$c++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// grab all youtube videos in news-body and add thumbnails to meta.
|
||||||
|
$youtube = e107::getBB()->getContent('youtube',$news['news_body']);
|
||||||
|
$c = 1;
|
||||||
|
foreach($youtube as $yt)
|
||||||
|
{
|
||||||
|
if($c == 3){ break; }
|
||||||
|
list($img,$tmp) = explode("?",$yt);
|
||||||
|
e107::meta('og:image',"http://img.youtube.com/vi/".$img."/0.jpg");
|
||||||
|
$c++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$url = e107::getUrl()->create('news/view/item', $news,'full=1');
|
$url = e107::getUrl()->create('news/view/item', $news,'full=1');
|
||||||
e107::meta('og:url',$url);
|
e107::meta('og:url',$url);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user