Jump to content



Photo

Change Page Title On Sort? [Script 8.6: A Registration Script]


  • Please log in to reply
4 replies to this topic

#1 bobafifi

bobafifi

    Newbie

  • Members
  • Pip
  • 14 posts

Posted 1 July 2017 - 5:23 AM

Hi Larry,

Google Webmaster tools is flagging this script for making duplicate page titles.  Can you please tell me how best to append/echo the sort order to the page Title in the HTML (switch $link1, $link2, $link3 - lnd, lna, fnd, fna, drd, dra)?

 

Thanks!


  • 0

#2 bobafifi

bobafifi

    Newbie

  • Members
  • Pip
  • 14 posts

Posted 1 July 2017 - 6:33 AM

OK - I got something working (not ideal). Made a new variable:

 

<?php
    $pageTitle = "$_SERVER[REQUEST_URI]";
 ?> 

 

and then in the title tags

 

<title>Example <?php echo $pageTitle ; ?></title>

 

Depending on the sort order, would like to change $pageTitle to echo different text, for example "A-Z" or "Z-A" (instead of /example.php?sort=lnd), but at least this prints unique page titles.


  • 0

#3 bobafifi

bobafifi

    Newbie

  • Members
  • Pip
  • 14 posts

Posted 1 July 2017 - 7:52 AM

Got it!

 

<?php if (false !== strpos($_SERVER['REQUEST_URI'], 'lna')) {
    echo 'A-Z';
}
?>


  • 0

#4 Larry

Larry

    Administrator/Writer

  • Administrators
  • 4785 posts
  • LocationState College, PA (USA)

Posted 3 July 2017 - 2:17 PM

Glad you got it working! I'm not positive that different sorts should be treated as different pages but it's cool you found a solution regardless!


  • 0

#5 bobafifi

bobafifi

    Newbie

  • Members
  • Pip
  • 14 posts

Posted 5 July 2017 - 10:35 AM

Hi Larry,

I agree - the sort order shouldn't constitute duplicate pages as there really is no new content being generated, just the same stuff rearranged. However for some reason, Google thinks differently. Maybe because the URL changes slightly, that's all it takes. They can't be sure if it's a new page or not, so they just go with new page?

 

-Bob


Edited by bobafifi, 5 July 2017 - 10:44 AM.

  • 0