Skip to content

Commit

Permalink
prevent title schema rewrites for custom titles (#529)
Browse files Browse the repository at this point in the history
Co-authored-by: Gregor Harlan <[email protected]>
  • Loading branch information
bitshiftersgmbh and gharlan authored Mar 31, 2023
1 parent 7343258 commit 8986b39
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions lib/yrewrite/seo.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,21 +147,15 @@ public function getRobotsTag()

public function getTitle()
{
$title_scheme = htmlspecialchars_decode(trim($this->domain->getTitle()));
if ('' == $title_scheme) {
$title_scheme = self::$title_scheme_default;
$title = $this->article->getValue(self::$meta_title_field);
if ('' == $title) {
$title = htmlspecialchars_decode(trim($this->domain->getTitle()));
}

$ytitle = '';
if ($this->article && '' != $this->article->getValue(self::$meta_title_field)) {
$ytitle = $this->article->getValue(self::$meta_title_field);
}
if ('' == $ytitle) {
$ytitle = $this->article->getValue('name');
if ('' == $title) {
$title = self::$title_scheme_default;
}

$title = $title_scheme;
$title = str_replace('%T', $ytitle, $title);
$title = str_replace('%T', $this->article->getValue('name'), $title);
$title = str_replace('%SN', rex::getServerName(), $title);

return $this->cleanString($title);
Expand Down

0 comments on commit 8986b39

Please sign in to comment.