Forum

Thread tagged as: Question, Blog

Blog listings - add page numbers to title tag

Hi,

For the purposes of SEO so that duplicate page titles are not flagged for page, category, tag and archive listings with pagination how can I put the current page number into the <title> tag?

Here is my current global.header layout I am using across the site

<?php 
    if (perch_layout_has('blog-post')) {
        perch_blog_post_meta(perch_get('s'));
    }
    elseif (perch_get('cat')) { echo '<title>';
    perch_blog_category(perch_get('cat'));
    echo ' </title>';
    }
    elseif (perch_get('tag')) { echo '<title>';
    perch_blog_tag(perch_get('tag'));
    echo '</title>';
    }
    else{
        echo '<title>' . perch_pages_title(true) . '</title>';
        perch_page_attributes(array(
        'template' => 'seo.html'
        ));
    }
?>
Neil Duddridge

Neil Duddridge 1 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Use:

PerchUtil::html(perch_get('page'))