Unique meta description and multiple list pages

4 posts by 3 authors in: Forums > CMS Builder
Last Post: July 15, 2015   (RSS)

By gregThomas - July 3, 2015

Hey Jeffncou,

What about doing something like this; at the top of the page check if there is anything set in the page request value (which is used by the getRecords function to check what page we're on). Then create a variable to store that information in:

<?php
  $extendedMetaDescription = '';
  if(@$_REQUEST['page']){
    $extendedMetaDescription . = "Page: " . intval($_REQUEST['page']);
  }
?>

Then when you load the page header and include the description meta tag, you can display the extendedMetaDescription variable after your hardcoded description.

<meta name="description" content="Description goes here. <?php echo @$extendedMetaDescription; ?>">

So if I was on page 4 of my results, the meta description would be "Description goes here. Page: 4"

Thanks,

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By Deborah - July 15, 2015

Greg,

I've been wanting to achieve this same thing for a long time. Thanks for posting this solution - it works great!

I wanted to share that had to remove the space before the equals sign to make it work for me, because with the space I got a blank HTML page.

was:
$extendedMetaDescription . = "Page: " . intval($_REQUEST['page']);

now:
$extendedMetaDescription .= " (Page " . intval($_REQUEST['page']) . ")";

~ Deborah

By gregThomas - July 15, 2015

Awesome, thanks for the feedback!

Greg Thomas







PHP Programmer - interactivetools.com