mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 06:38:00 +02:00
Issue #4783 Site name was still being appended to the <title> tag. Site name has now been removed when using news_meta_title.
This commit is contained in:
@@ -109,6 +109,12 @@ function render_title()
|
|||||||
define('e_PAGETITLE', $_PAGE_TITLE);
|
define('e_PAGETITLE', $_PAGE_TITLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($_FULL_TITLE = e107::getSingleton('eResponse')->getMetaTitle(true)) // override entire title. @see news_meta_title
|
||||||
|
{
|
||||||
|
$arr = array($_FULL_TITLE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$arr = [];
|
$arr = [];
|
||||||
|
|
||||||
if(!deftrue('e_FRONTPAGE'))
|
if(!deftrue('e_FRONTPAGE'))
|
||||||
@@ -124,6 +130,7 @@ function render_title()
|
|||||||
}
|
}
|
||||||
|
|
||||||
$arr[] = SITENAME;
|
$arr[] = SITENAME;
|
||||||
|
}
|
||||||
|
|
||||||
if($custom = e107::callMethod('theme', 'title', $arr))
|
if($custom = e107::callMethod('theme', 'title', $arr))
|
||||||
{
|
{
|
||||||
|
@@ -4093,7 +4093,8 @@ class eResponse
|
|||||||
{
|
{
|
||||||
protected $_body = array('default' => '');
|
protected $_body = array('default' => '');
|
||||||
protected $_title = array('default' => array());
|
protected $_title = array('default' => array());
|
||||||
protected $_e_PAGETITLE = array();
|
protected $_e_PAGETITLE = array(); // partial <title> tag.
|
||||||
|
protected $_e_PAGETITLE_OVERRIDE = array(); // Full <title> tag
|
||||||
protected $_META_DESCRIPTION = array();
|
protected $_META_DESCRIPTION = array();
|
||||||
protected $_META_KEYWORDS = array();
|
protected $_META_KEYWORDS = array();
|
||||||
protected $_render_mod = array('default' => 'default');
|
protected $_render_mod = array('default' => 'default');
|
||||||
@@ -4600,7 +4601,7 @@ class eResponse
|
|||||||
{
|
{
|
||||||
$content = str_replace('&', '&', $content);
|
$content = str_replace('&', '&', $content);
|
||||||
|
|
||||||
if($meta !== '_e_PAGETITLE')
|
if($meta !== '_e_PAGETITLE' && $meta !== '_e_PAGETITLE_OVERRIDE')
|
||||||
{
|
{
|
||||||
$content = htmlspecialchars((string) $content, ENT_QUOTES, 'UTF-8');
|
$content = htmlspecialchars((string) $content, ENT_QUOTES, 'UTF-8');
|
||||||
}
|
}
|
||||||
@@ -4642,23 +4643,40 @@ class eResponse
|
|||||||
* @param string $title
|
* @param string $title
|
||||||
* @return eResponse
|
* @return eResponse
|
||||||
*/
|
*/
|
||||||
public function addMetaTitle($title, $reset=false)
|
public function addMetaTitle($title, $reset=false, $override=false)
|
||||||
{
|
{
|
||||||
if($reset)
|
if($reset)
|
||||||
|
{
|
||||||
|
if($override)
|
||||||
|
{
|
||||||
|
$this->_e_PAGETITLE_OVERRIDE = array();
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
$this->_e_PAGETITLE = array();
|
$this->_e_PAGETITLE = array();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$title = str_replace([''','''], "'", $title);
|
$title = str_replace([''','''], "'", $title);
|
||||||
|
|
||||||
|
if($override)
|
||||||
|
{
|
||||||
|
return $this->addMetaData('e_PAGETITLE_OVERRIDE', $title);
|
||||||
|
}
|
||||||
|
|
||||||
return $this->addMetaData('e_PAGETITLE', $title);
|
return $this->addMetaData('e_PAGETITLE', $title);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getMetaTitle()
|
public function getMetaTitle($override = false)
|
||||||
{
|
{
|
||||||
|
if($override)
|
||||||
|
{
|
||||||
|
return $this->getMetaData('e_PAGETITLE_OVERRIDE', $this->_meta_title_separator);
|
||||||
|
}
|
||||||
|
|
||||||
return $this->getMetaData('e_PAGETITLE', $this->_meta_title_separator);
|
return $this->getMetaData('e_PAGETITLE', $this->_meta_title_separator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2825,14 +2825,15 @@ class e107
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Page Title ie. <title>Whatever</title>
|
* Set the Page Title ie. <title>Whatever | SITENAME</title> or <title>Whatever</title>
|
||||||
* @param string $title
|
* @param string $title
|
||||||
|
* @param string $override will remove any additional data from the <title> tag. eg. | SITENAME etc.
|
||||||
*/
|
*/
|
||||||
public static function title($title)
|
public static function title($title, $override=false)
|
||||||
{
|
{
|
||||||
/** @var eResponse $response */
|
/** @var eResponse $response */
|
||||||
$response = self::getSingleton('eResponse');
|
$response = self::getSingleton('eResponse');
|
||||||
$response->addMetaTitle($title, true);
|
$response->addMetaTitle($title, true, $override);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -662,7 +662,7 @@ class news_front
|
|||||||
|
|
||||||
if(!empty($news['news_meta_title'])) // override title with meta title.
|
if(!empty($news['news_meta_title'])) // override title with meta title.
|
||||||
{
|
{
|
||||||
e107::title($news['news_meta_title']);
|
e107::title($news['news_meta_title'], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($news['news_meta_description'] && !defined('META_DESCRIPTION'))
|
if($news['news_meta_description'] && !defined('META_DESCRIPTION'))
|
||||||
|
Reference in New Issue
Block a user