Pagination - Page title

Permalink
Hi I'm looking to see how I can integrate the page number into <title> tag - I'm receiving duplicate page titles on my paginated index which could be affecting my SEO

there are 50 pages in total, all with 'blog archive' as the title

Do I need to edit the Header_required.php or is there a shortcode i can use? (suchas %pagenumber)

If its a PHP page, does anyone know the precise code?

 
guythomas replied on at Permalink Reply
guythomas
I had a customer ask me about this just the other week. Their SEO and I convinced them it would not be a problem, but your question does have an answer, and it does lie in the header_required.php file.

My simplistic method requires you know the name of the GET variable that causes the paging. To do this, go to the second page of your blog archive and look at the URL in the address bar. It should end in something like this:

/?ccm_paging_p_b205=2

The text after the question mark and before the equals sign is the $_GET variable name. In my case "ccm_paging_p_b205".

Now you are ready to override the header_required.php file.

Copy the existing /concrete/elements/header_required.php file into the /elements/ directory.

Open your new header_required.php file and look for the code around line 26 that reads as follows:

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  }


using your $_GET variable name change that block to look like this:

if ($akt) { 
   $pageTitle = $akt; 
   if ($_GET['ccm_paging_p_b205']){
      $pageTitle = $pageTitle . " | Page " . $_GET['ccm_paging_p_b205'];
   }
   ?><title><?php  echo htmlspecialchars($pageTitle, 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  }


That should do the trick. If you have multiple blocks that create duplicate title issues your code is going to increase in complexity, but if it is just one, like a blog index, this should do the trick.

-Guy
designsforchange replied on at Permalink Reply
designsforchange
Hi Guy,

I know your post was a couple of years ago, but I'm having the same issue in 5.6.3.2. My SEO person is not happy. Do you know if this will work in my current version or if there is a different fix?

Any help is greatly appreciated!

Cheers