mirror of
https://github.com/e107inc/e107.git
synced 2025-08-31 02:00:14 +02:00
#5422 Support for schema. News schema added and FAQs schema template simplified.
This commit is contained in:
@@ -44,6 +44,8 @@ class news_front
|
||||
private $tagAuthor = null;
|
||||
private $comments = array();
|
||||
private $pagination;
|
||||
|
||||
private $schema = '';
|
||||
// private $interval = 1;
|
||||
|
||||
function __construct()
|
||||
@@ -824,6 +826,7 @@ class news_front
|
||||
$e107cache->set($cache_tag."_diz", defined("META_DESCRIPTION") ? META_DESCRIPTION : '');
|
||||
|
||||
$e107cache->set($cache_tag."_rows", e107::serialize($rowData,'json'));
|
||||
$e107cache->set($cache_tag."_schema", $this->schema);
|
||||
|
||||
}
|
||||
|
||||
@@ -1238,6 +1241,12 @@ class news_front
|
||||
$this->setNewsFrontMeta($rows);
|
||||
$text = $this->renderCache($caption, $newsCachedPage); // This exits if cache used
|
||||
$this->comments = $rows;
|
||||
|
||||
if($shema = $this->getNewsCache($this->cacheString,'schema'))
|
||||
{
|
||||
e107::schema($shema);
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
else
|
||||
@@ -1354,6 +1363,12 @@ class news_front
|
||||
$render = true;
|
||||
}
|
||||
|
||||
if(!empty($tmp['schema']))
|
||||
{
|
||||
$this->schema = e107::getParser()->parseSchemaTemplate($tmp['schema'], true, $nsc);
|
||||
e107::schema($this->schema);
|
||||
}
|
||||
|
||||
unset($tmp);
|
||||
}
|
||||
|
||||
|
@@ -88,6 +88,7 @@ $NEWS_VIEW_TEMPLATE['default']['item'] = '
|
||||
';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* <hr />
|
||||
<h3>About the Author</h3>
|
||||
@@ -101,6 +102,38 @@ $NEWS_VIEW_TEMPLATE['default']['item'] = '
|
||||
</div>
|
||||
*/
|
||||
|
||||
$NEWS_VIEW_TEMPLATE['default']['schema'] = '
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "NewsArticle",
|
||||
"mainEntityOfPage": {
|
||||
"@type": "WebPage",
|
||||
"@id": "{NEWS_URL: full=1}"
|
||||
},
|
||||
"headline": "{NEWS_TITLE}",
|
||||
"description": "{NEWS_DESCRIPTION}",
|
||||
"image": [
|
||||
"{SETIMAGE: w=800&h=800}{NEWS_IMAGE: item=1&return=url}"
|
||||
],
|
||||
"author": {
|
||||
"@type": "Person",
|
||||
"name": "{NEWS_AUTHOR=nolink}"
|
||||
},
|
||||
"publisher": {
|
||||
"@type": "Organization",
|
||||
"name": "{ORGANIZATION}",
|
||||
"logo": {
|
||||
"@type": "ImageObject",
|
||||
"url": "{SITEBUTTON: type=url}"
|
||||
}
|
||||
},
|
||||
"datePublished": "{NEWS_DATE=atom}",
|
||||
"dateModified": "{NEWS_MODIFIED=atom}",
|
||||
"articleBody": "{NEWS_BODY=raw}"
|
||||
|
||||
}
|
||||
';
|
||||
|
||||
|
||||
// @todo add more templates. eg. 'videos' , 'slideshow images', 'full width image' - help and ideas always appreciated.
|
||||
|
||||
|
Reference in New Issue
Block a user