Custom Page Title in v5.5
PermalinkPage Title | Site Title
If there was a Meta Title it would read:
Meta Title | Site Title
I did this by replacing the following in elements/header_required.php:
if ($akt) { $pageTitle = $akt; ?><title><?php echo htmlspecialchars($akt, ENT_COMPAT, APP_CHARSET)?></title> <?php } else { $pageTitle = htmlspecialchars($pageTitle, ENT_COMPAT, APP_CHARSET); ?><title><?php echo sprintf(PAGE_TITLE_FORMAT, SITE, $pageTitle)?></title> <?php }
With:
if ($akt) { $pageTitle = htmlspecialchars($akt, ENT_COMPAT, APP_CHARSET); ?> <title><?php echo sprintf(PAGE_TITLE_FORMAT, $siteTitle, $pageTitle)?></title> <?php } else { $pageTitle = htmlspecialchars($c->getCollectionName(), ENT_COMPAT, APP_CHARSET); ?> <title><?php echo sprintf(PAGE_TITLE_FORMAT, $siteTitle, $pageTitle)?></title> <?php }
And adding this to the config/site.php file:
define('PAGE_TITLE_FORMAT', '%2$s | %1$s');
This however no longer works in v5.5 could anybody please advise a fix?
Thanks in advance, Ben
Thanks for this, I have replaced $siteTitle with SITE and it now appears to be working, strange I had always used $siteTitle before as that was what I had once been told to do and it had always worked up until now.
Thanks anyway, nice and simple fix! your a star ;)
What specifically does not work? SITE constant should be used for the site name if you want to use your site's name in the title.
It should work the same way in 5.5...
- Antti / Mainio