Merge pull request #902 from annando/master

schema.org and oembed
This commit is contained in:
tobiasd 2014-01-28 09:28:43 -08:00
commit d473cd9bc9
3 changed files with 35 additions and 9 deletions

View file

@ -105,16 +105,34 @@ function oembed_format_object($j){
}; break;
case "rich": {
// not so safe..
if (!get_config("system","no_oembed_rich_content"))
$ret.= $jhtml;
}; break;
}
// add link to source if not present in "rich" type
if ($j->type!='rich' || !strpos($j->html,$embedurl) ){
if (isset($j->provider_name)) $ret .= $j->provider_name.": ";
if (isset($j->title)) {
if (isset($j->provider_name))
$ret .= $j->provider_name.": ";
$embedlink = (isset($j->title))?$j->title:$embedurl;
$ret .= "<a href='$embedurl' rel='oembed'>$embedlink</a>";
if (isset($j->author_name)) $ret.=" (".$j->author_name.")";
if (isset($j->author_name))
$ret.=" (".$j->author_name.")";
} elseif (isset($j->provider_name) OR isset($j->author_name)) {
$embedlink = "";
if (isset($j->provider_name))
$embedlink .= $j->provider_name;
if (isset($j->author_name)) {
if ($embedlink != "")
$embedlink .= ": ";
$embedlink .= $j->author_name;
}
$ret .= "<a href='$embedurl' rel='oembed'>$embedlink</a>";
}
//if (isset($j->author_name)) $ret.=" by ".$j->author_name;
//if (isset($j->provider_name)) $ret.=" on ".$j->provider_name;
} else {

View file

@ -216,12 +216,20 @@ function display_content(&$a, $update = 0) {
$a->page['htmlhead'] .= '<meta name="fulltitle" content="'.$title.'" />'."\n";
$a->page['htmlhead'] .= '<meta name="description" content="'.$description.'" />'."\n";
// Schema.org microdata
$a->page['htmlhead'] .= '<meta itemprop="name" content="'.$title.'" />'."\n";
$a->page['htmlhead'] .= '<meta itemprop="description" content="'.$description.'" />'."\n";
$a->page['htmlhead'] .= '<meta itemprop="image" content="'.$r[0]["thumb"].'" />'."\n";
$a->page['htmlhead'] .= '<meta itemprop="author" content="'.$author_name.'" />'."\n";
// Dublin Core
$a->page['htmlhead'] .= '<meta name="DC.title" content="'.$title.'" />'."\n";
$a->page['htmlhead'] .= '<meta name="DC.description" content="'.$description.'" />'."\n";
// Open Graph
$a->page['htmlhead'] .= '<meta property="og:type" content="website" />'."\n";
$a->page['htmlhead'] .= '<meta property="og:title" content="'.$title.'" />'."\n";
//<meta property="og:image" content="" />
$a->page['htmlhead'] .= '<meta property="og:image" content="'.$r[0]["thumb"].'" />'."\n";
$a->page['htmlhead'] .= '<meta property="og:url" content="'.$r[0]["plink"].'" />'."\n";
$a->page['htmlhead'] .= '<meta property="og:description" content="'.$description.'" />'."\n";
$a->page['htmlhead'] .= '<meta name="og:article:author" content="'.$author_name.'" />'."\n";

View file

@ -1,5 +1,5 @@
<!DOCTYPE html >
<html>
<html itemscope itemtype="http://schema.org/Blog" />
<head>
<title><?php if(x($page,'title')) echo $page['title'] ?></title>
<script>var baseurl="<?php echo $a->get_baseurl() ?>";</script>