Thanks @RolluS. I've cleaned up them on github.
Hi @adesh1414127033 , could you please review this enhancement?
When sharing a forum link on Facebook, there's not any image display. Example this topic link: http://codologic.com/forum/index.php?u=/topic/3935/codoforum-seo-discuss
The root cause is that there is not og:image property in the Open Graph data
<!-- Open Graph data -->
<meta property="og:title" content="Codoforum SEO discuss" />
<meta property="og:type" content="article" />
<meta property="og:url" content="http://codologic.com/forum/index.php?u=/topic/3935/codoforum-seo-discuss/" />
<meta property="og:description" content="Is there any one like SEO? :D I have some ideas and did them.Please give your comments if you like them.- Clean URL I hate this one:http://www.nguoianphu.com/index.php?u=category/news-and-ann..." />
<meta property="og:site_name" content="CODOLOGIC" />
I suggest we add some lines into the sys\Controller\forum.php, line 421
// Get image link for Facebook sharing
// search the first image link from the first post of the topic
$image = $posts[0]['message'];
// initialize the image link with the default thumbnail image
$img_src = 'http://www.domain.com/logo420.png';
// pattern to get the src value in the img tag
$pattern = '/src="([^"]*)"/';
// If found image link, use it. Else, use the default
preg_match($pattern, $image, $matches);
if (!empty($matches[1])){
$img_src = $matches[1];
}
unset($matches);
// Set the Open Graph image property
\CODOF\Store::set('og:image', $img_src);
I'm pretty sure that you have to correct my block of code. 
Thanks @RolluS. I've cleaned up them on github.
Hi @adesh1414127033 , could you please review this enhancement?
When sharing a forum link on Facebook, there's not any image display. Example this topic link: http://codologic.com/forum/index.php?u=/topic/3935/codoforum-seo-discuss
The root cause is that there is not ```og:image``` property in the ```Open Graph data```
&lt;!-- Open Graph data --&gt;
&lt;meta property="og:title" content="Codoforum SEO discuss" /&gt;
&lt;meta property="og:type" content="article" /&gt;
&lt;meta property="og:url" content="http://codologic.com/forum/index.php?u=/topic/3935/codoforum-seo-discuss/" /&gt;
&lt;meta property="og:description" content="Is there any one like SEO? :D I have some ideas and did them.Please give your comments if you like them.- Clean URL I hate this one:http://www.nguoianphu.com/index.php?u=category/news-and-ann..." /&gt;
&lt;meta property="og:site_name" content="CODOLOGIC" /&gt;
I suggest we add some lines into the ```sys\Controller\forum.php```, line 421
// Get image link for Facebook sharing
// search the first image link from the first post of the topic
$image = $posts[0]['message'];
// initialize the image link with the default thumbnail image
$img_src = 'http://www.domain.com/logo420.png';
// pattern to get the src value in the img tag
$pattern = '/src="([^"]*)"/';
// If found image link, use it. Else, use the default
preg_match($pattern, $image, $matches);
if (!empty($matches[1])){
$img_src = $matches[1];
}
unset($matches);
// Set the Open Graph image property
\CODOF\Store::set('og:image', $img_src);
I'm pretty sure that you have to correct my block of code. :D
NguoiAnPhu.com
Powered by Codoforum 4.3
(https://github.com/nguoianphu/codoforums-vietnam).

