[5.7] Custom page title format

Permalink
Does anyone have a pointer on how to modify the page title format in 5.7?

I've done a bit of searching around, all I've turned up ishttp://www.concrete5.org/documentation/how-tos/editors/change-the-f... which doesn't seem to work, and since other config variables are now defined in an array returned from config/*.php files, I imagine this is why.

Ideally I'd like to go further than that example anyway, and do something like:

Page title - Section title - Site name - Tagline

Any hints much appreciated.

 
juddc replied on at Permalink Reply
juddc
http://www.concrete5.org/community/forums/5-7-discussion/c57-title-format/
danielgwood replied on at Permalink Reply
Thanks.

Halfway there, though it won't help me with the section title part (tagline I can manually add here I suppose).
danielgwood replied on at Permalink Best Answer Reply
So I've finally gone back to this, and this is what I have:

<?php
$generateTitle = function() {
    $title = '';
    $c = \Page::getCurrentPage();
    if(is_object($c) && $c instanceof \Page && !$c->isError()) {
        if($c->getCollectionID() == HOME_CID) {
            // Home page
            $title = \Config::get('concrete.site') . ' — My awesome website description';
        } else if(isset($_GET['query'])) {
            // Search results
            $title = 'Search results for "' . strip_tags($_GET['query']) . '"';
            $title .= ' - ' . \Config::get('concrete.site');
        } else {
            // Regular page
            $title = $c->getCollectionAttributeValue('meta_title');


It's a little more flexible in that it includes all parent page titles (as these represent sections for me), shows a custom title for search results, and a custom title for the homepage.