Add getTags() and getHashtags() to document item

This commit is contained in:
Kijin Sung 2018-03-15 12:34:51 +09:00
parent e4fb4e1dbf
commit fb73a0d410
2 changed files with 19 additions and 7 deletions

View file

@ -526,19 +526,19 @@ class HTMLDisplayHandler
// Add tags and hashtags for articles.
if ($page_type === 'article')
{
$tags = array_unique(array_map('utf8_trim', explode(',', $oDocument->get('tags'))));
$tags = $oDocument->getTags();
foreach ($tags as $tag)
{
if ($tag !== '')
{
Context::addOpenGraphData('og:article:tag', escape($tag, false));
Context::addOpenGraphData('og:article:tag', $tag, false);
}
}
if (config('seo.og_extract_hashtags'))
{
preg_match_all('/#([\pL\pN_]+)/u', strip_tags($oDocument->get('content')), $hashtags);
foreach ($hashtags[1] as $hashtag)
$hashtags = $oDocument->getHashtags();
foreach ($hashtags as $hashtag)
{
if (!in_array($hashtag, $tags))
{