Thread tagged as: Question, Problem, Runway

How do you get Collection content into Page Title

I am currently using this code for the global header, however what needs to go in to get the 'make' field from my 'make' collection if I am on a Make page?

if (perch_layout_has('blog-post')) {
    elseif (perch_get('cat')) { echo '<title>';
    echo ' Car Leasing Blog</title>';
    elseif (perch_get('tag')) { echo '<title>Articles tagged with ';
    echo '</title>';
    elseif (perch_get('make_slug')) { echo '<title>';


        echo ' Car Leasing</title>';

        echo '<title>' . perch_pages_title(true) . '</title>';
        'template' => 'seo.html'

Neil Duddridge

Neil Duddridge 1 points

  • 4 years ago

I figured it out :)

    elseif (perch_get('make_slug')) { 

        perch_get(perch_collection('Make', [
        'filter' => 'slug',
        'template' => 'make_meta.html',
        'value'  => perch_get('make_slug'),


If there is a better or cleaner way let me know! :)

Drew McLellan

Drew McLellan 2638 points
Perch Support

What's the purpose of the perch_get() around the perch_collection() ?

It didn't seem to work when I tried it initially, I'll try it again without :)

Ok stripped that out now, works fine still. I was scratching my head about it earlier as I kept getting a blank page.

Code now:

elseif (perch_get('make_slug')) { 

perch_collection('Make', [
'filter' => 'slug',
'template' => 'make_meta.html',
'value' => perch_get('make_slug'),