Add a page number to category pages meta title

If you’ve used Google’s Webmaster tools, you may have noticed there are times that categories with multiple pages show up as ‘duplicate title’ in the HTML improvements section.

By adding a ‘Page ##’ in the meta title, you can avoid this warning and also make it easier for your page viewers to navigate where they are.

OPEN: app/design/frontend/YOURPACKAGE/YOURTHEME/page/html/head.phtml

add the first line of code right above the <title> line and also insert the “; echo $page_num;” right after $this->getTitle()

(Note: depending on your template, the code sequence may vary slightly)

<?php if (isset($_GET['p'])) {
$number = $_GET['p'];
if ($number > 1) { $page_num = " - Page $number"; } else {$page_num = "";}
} else {$page_num = "";} ?>
<title><?php echo $this->getTitle(); echo $page_num; ?></title>

Now you’ll notice that any category pages > 1 (1 was ignored so that a duplicate isn’t created when there’s no page number specified) will show the category title along with ” – Page XX”


Leave a Reply