Howdy,
mit etwas frontend_render Script, kannst du das hinbekommen.
Ich habe das mal schnell zusammengehackt:
kopiere den Code in eine php Datei unter template/inc_script/frontend_render/sharing_meta.php
Code: Select all
<?php
// ----------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {
die("You Cannot Access This Script Directly, Have a Nice Day.");
}
// ----------------------------------------------------------------
// check if we are in single news view, then set news title
if($news['result'][0]['cnt_title'] && count($news['result']) == 1){
$content['pagetitle'] = ($news['result'][0]['cnt_title'])?$news['result'][0]['cnt_title']:$content['pagetitle'];
}
// function to set special metatags
function _set_meta($name='', $content='', $attribute = 'name') {
if(empty($name) || empty($content)) {
return NULL;
}
$GLOBALS['block']['custom_htmlhead']['meta.'.$name] = ' <meta ';
$GLOBALS['block']['custom_htmlhead']['meta.'.$name] .= $attribute;
$GLOBALS['block']['custom_htmlhead']['meta.'.$name] .= '="' . $name . '" content="'.html_specialchars($content).'" />';
}
// additional sharing metatags
$standard_sharing_img = 'http://path-to-standard-img.com/picture.jpg';
_set_meta('fb:admins','YOURFACEBOOKID','property');
_set_meta('title',$content['pagetitle'],'name');
_set_meta('og:title',$content['pagetitle'],'property');
//_set_meta('og:type','album','property');
//_set_meta('og:site_name','Your Sitename','property');
// display article image in sharing service
if(!empty($article_meta["article_image"]["hash"])) {
$article_meta_thumb = get_cached_image(
array( "target_ext" => $article_meta["article_image"]['ext'],
"image_name" => $article_meta["article_image"]['hash'] . '.' . $article_meta["article_image"]['ext'],
"max_width" => 250,
"max_height" => 250,
"crop_image" => true,
"thumb_name" => md5($article_meta["article_image"]['hash'].'250250'.$GLOBALS['phpwcms']["sharpen_level"])
));
if($article_meta_thumb != false) {
$article_meta_thumb = PHPWCMS_URL.PHPWCMS_IMAGES.$article_meta_thumb[0];
}else{
$article_meta_thumb = $standard_sharing_img ;
}
}else{
$article_meta_thumb = $standard_sharing_img ;
}
if($article_meta_thumb){
_set_meta('og:image',$article_meta_thumb,'property');
$block['custom_htmlhead']["image_src"] = ' <link rel="image_src" href="'.$article_meta_thumb.'" />';
}
?>
das ist nicht besonders schön und elegant, aber sollte funktionieren und enthält gleich alle FB standardtags.
Das funktioniert auch nur für die Newsdetailseite richtig.
Also wenn der Button auch auf der Newsübersichtsseite auftaucht, dann teilst du nur die Übersichtsseite!
Ansonsten funktioniert der code für alle Seiten in phpwcms inkl. Artikelbild, wenn vorhanden (Newsbild wird (noch) nicht genutzt).
Und Metadescription/Artikelbeschreibung sollte natürlich auch vorhanden sein
Wenn ich mich recht erinnere bietet die FB API auch an, die Parameter an die URL des FB sharing links zu hängen. Bin mir aber nicht sicher.
Du kannst deine Seite mit dem FB Linttool prüfen:
http://developers.facebook.com/tools/lint
Und hier ist eine Seite wo ich das mal eben umgesetzt habe.
http://ur.ly/DCsj