1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 13:47:31 +02:00

Add og:title by default. Set open-graph data for frontpage.

This commit is contained in:
Cameron
2021-10-01 08:35:54 -07:00
parent 4f5eb66048
commit e06069459f
2 changed files with 12 additions and 10 deletions

View File

@@ -129,7 +129,7 @@ else
echo "<head> echo "<head>
<title>".render_title()."</title> <title>".render_title()."</title>
<meta http-equiv='content-type' content='text/html; charset=utf-8' /> <meta http-equiv='content-type' content='text/html; charset=utf-8' />
<meta http-equiv='content-style-type' content='text/css' /> <meta http-equiv='content-style-type' content='text/css' />
"; ";
echo (defined("CORE_LC")) ? "<meta http-equiv='content-language' content='".CORE_LC."' />\n" : ""; echo (defined("CORE_LC")) ? "<meta http-equiv='content-language' content='".CORE_LC."' />\n" : "";
} }
@@ -140,6 +140,7 @@ function render_title()
{ {
define('e_PAGETITLE', $_PAGE_TITLE); define('e_PAGETITLE', $_PAGE_TITLE);
e107::meta('og:title', $_PAGE_TITLE); // will only populate if not already defined. e107::meta('og:title', $_PAGE_TITLE); // will only populate if not already defined.
e107::meta('twitter:title', $_PAGE_TITLE);
} }
$arr = []; $arr = [];
@@ -155,6 +156,12 @@ function render_title()
$arr[] = PAGE_NAME; $arr[] = PAGE_NAME;
} }
} }
else // Frontpage
{
e107::meta('og:type', 'website');
e107::meta('og:title', SITENAME);
e107::meta('twitter:title', SITENAME);
}
$arr[] = SITENAME; $arr[] = SITENAME;

View File

@@ -567,23 +567,19 @@ class news_front
case "tag": case "tag":
e107::title($this->subAction); e107::title($this->subAction);
e107::meta('og:title', $this->subAction);
e107::meta('robots', 'noindex'); e107::meta('robots', 'noindex');
e107::route('news/list/tag'); e107::route('news/list/tag');
break; break;
case "author": case "author":
e107::title($this->subAction); e107::title($this->subAction);
e107::meta('og:title', $this->subAction);
e107::meta('robots', 'noindex'); e107::meta('robots', 'noindex');
e107::route('news/list/author'); e107::route('news/list/author');
break; break;
case "list": case "list":
$title = $tp->toHTML($news['category_name'],false,'TITLE_PLAIN'); $title = $tp->toHTML($news['category_name'],false,'TITLE_PLAIN');
e107::title($title); e107::title($title);
e107::meta('og:title', $title);
e107::meta('robots', 'noindex'); e107::meta('robots', 'noindex');
e107::route('news/list/category'); e107::route('news/list/category');
break; break;
@@ -608,13 +604,14 @@ class news_front
$this->dayMonth = $title; $this->dayMonth = $title;
e107::title($title); e107::title($title);
e107::meta('og:title', $title);
e107::meta('robots', 'noindex'); e107::meta('robots', 'noindex');
if($type == 'day') { if($type == 'day')
{
e107::route('news/list/day'); e107::route('news/list/day');
} }
else { else
{
e107::route('news/list/month'); e107::route('news/list/month');
} }
@@ -644,10 +641,8 @@ class news_front
if($news['news_title']) if($news['news_title'])
{ {
e107::title($news['news_title']); e107::title($news['news_title']);
e107::meta('og:title',$news['news_title']);
e107::meta('og:type','article'); e107::meta('og:type','article');
e107::meta('twitter:card', 'summary'); e107::meta('twitter:card', 'summary');
e107::meta('twitter:title',$news['news_title']);
} }
if($news['news_meta_description'] && !defined('META_DESCRIPTION')) if($news['news_meta_description'] && !defined('META_DESCRIPTION'))