Member
Member
wumpus   2010-02-28, 03:19
#1
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!
Member
Member
gjr   2010-02-28, 04:48
#2
just guessing, for album.php, to get page number in when the album has more than one page....

`

<title>

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

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

} else {

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

} ?>

</title>

`

or if you want page numbers always...

`

<title>

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

</title>

`
Member
Member
gjr   2010-02-28, 05:05
#3
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') {

`
Member
Member
wumpus   2010-02-28, 05:48
#4
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().')';};?>
`
Member
Member
reneesanguinetti   2011-06-18, 13:18
#5
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.
Administrator
Administrator
acrylian   2011-06-18, 16:25
#6
You should open a new thread as you question is theme specific. I really doubt that the theme's author will notice this otherwise...
Member
Member
Michel Gagnon   2011-06-19, 22:25
#7
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
Member
Member
wdiggles   2011-06-21, 03:54
#8
@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.
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.