Current album page in my page title

I want to append "(Page 2)" to my html <title> on each album when I am on page 2 or higher. This way Google isn't indexing duplicate page titles for my paginated albums. I'm using v1.26 currently.

I believe this involves an if statement using the function getAlbumPage() but I'm not really a coder so if someone could point me in the right direction I'd be grateful. Thanks!

Comments

  • just guessing, for album.php, to get page number in when the album has more than one page....

    `



    <?php if ((getAlbumPage()) > 1) {

    echo getBareGalleryTitle().' | '.getBareAlbumTitle().' | Page '.getAlbumPage();

    } else {

    echo getBareGalleryTitle().' | '.getBareAlbumTitle();

    } ?>



    `

    or if you want page numbers always...

    `



    <?php echo getBareGalleryTitle().' | '.getBareAlbumTitle().' | Page '.getAlbumPage();?>



    `
  • looking at that, not sure if the function returns an integer or string, if that doesn't work you could try replaceing the if with...

    `

    <?php if ((getAlbumPage()) != '1') {<br />
    `
  • Thanks for your help. After trying what you said, I finally realized that getAlbumPage only applies to the current image, not the current album (it kept returning 0).

    I searched further and discovered there is a getCurrentPage() function(!).

    So this is the code that worked (again, thanks to you for getting me here):

    `
    <?php if ((getCurrentPage()) > 1) {
    echo '(Page '.getCurrentPage().')';};?>
    `
  • I also would like to add page numbers to the titles on page 2 or higher. Currently using zpfocus_v1.4. Where do I place this code?
    <?php if ((getCurrentPage()) > 1) {
    echo '(Page '.getCurrentPage().')';};?>
    Thank-you.
  • acrylian Administrator, Developer
    You should open a new thread as you question is theme specific. I really doubt that the theme's author will notice this otherwise...
  • It's indeed theme-specific. But as a general principle:
    – Go in the /themes/Your_theme folder
    – Look for files such as album.php, gallery.php, image.php
    – Find "breadcrumb" style; this is very likely to be where you have the title of the page displayed
  • @reneesanguinetti

    If you mean the page title as seen in google search results you would put the code in between the <title> tags of your album.php file. Just added it to my site and it works wonderfully.
Sign In or Register to comment.