Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: My five cent's on Coppermine SEO  (Read 11470 times)

0 Members and 1 Guest are viewing this topic.

jayhunter

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 29
My five cent's on Coppermine SEO
« on: December 14, 2010, 12:45:57 am »

Hi guys.

This should be moved to Modifications/Add-Ons/Hacks.

Finally, google spidered my gallery and I have some information in the webmaster tools.

Link text is one of the most important SEO properties beside title and h1 tags. The top most link texts google found for my gallery are:
  • return to start
  • see previous file
  • see next file
  • http www htbackdrops com v2 displayimage php pid
  • return to the thumbnail page

Wow. That is so generic and meaningless. These have a major impact on the ranking. The links are generated in the intermediate page navigation (default theme).
As far as my gallery goes the most important information google should know are the image titles. I still want the links to be "see next file", .. as this is what they do, but have significant keywords with it. (One could think of eleminating the "see next file" text alltogether for even better results ...).

So I took the function theme_html_img_nav_menu from include/themes.inc.php copied it into my theme.php and applied the folowing changes:

Code: [Select]
// Add line to top
    global $CURRENT_ALBUM_DATA;


// Change line
        $start_title = $lang_img_nav_bar['go_album_start'];
// To
        $start_title = $lang_img_nav_bar['go_album_start'] . " ({$pic_data[$start]['title']})";


// Change line
        $prev_title = $lang_img_nav_bar['prev_title']";
// To
        $prev_title = $lang_img_nav_bar['prev_title'] . " ({$pic_data[$prev]['title']})";


// Change line
        $end_title = $lang_img_nav_bar['go_album_end'];
// To
        $end_title = $lang_img_nav_bar['go_album_end'] . " ({$pic_data[$end]['title']})";


// Change line
        $next_title = $lang_img_nav_bar['next_title'];
// To
        $next_title = $lang_img_nav_bar['next_title'] . " ({$pic_data[$next]['title']})";


// Change line
    $meta_nav .= "<link rel=\"up\" href=\"$thumb_tgt\" title=\"".$lang_img_nav_bar['thumb_title']. "\"/>" . $LINEBREAK;
// To
    $meta_nav .= "<link rel=\"up\" href=\"$thumb_tgt\" title=\"".$lang_img_nav_bar['thumb_title']. " ({$CURRENT_ALBUM_DATA['title']})". "\"/>" . $LINEBREAK;

This way the image titles and album titles are propagated much more efficent imho.
Many say that SEF URLs like www.bla.com/IMAGE_TITLE.html would be so important, but I think this easy hack has an impact atleast as high as SEF URLs.

What is left as top link text is "http www htbackdrops com v2 displayimage php pid". This also is found on the intermediate page in the file information. It could be a good thing to remove the link from the URL text and just leave it as it is. Instead have the image title linked to the intermediate page (don't know how google treats links to the same page a link is on though) or maybe the image (fullsize) itself. This should be done at the top of the file information box, so that hopefully google starts to recognize the important content from there on.

I came to this conclusion because the description google shows for my intermediate pages all start with
Code: [Select]
URL: http://www.htbackdrops.com/v2/displayimage.php?pid=xxx. Favorites: Add to Favorites. Download Full Size Link: Save this link or open ...
(if there is no image description given; through meta tag or beneath the image).

This will give the image title even more importance.

The last thing I did to tune up the image title and make the filename less important is a little hack in functions.inc.php

Code: [Select]
// Change line
            $thumb_list[$i]['image']        = '<img src="' . $pic_url . '" class="image" ' . $image_size['geom'] . ' border="0" alt="' . $row['filename'] . '" title="' . $pic_title . '" />';
// TO
            $thumb_list[$i]['image']        = '<img src="' . $pic_url . '" class="image" ' . $image_size['geom'] . ' border="0" alt="' . $row['title'] . '" title="' . $pic_title . '" />';

This does change the image alt tag on the thumbnailpage and will hopefully give other keywords than "jpg" a higher rating. (Has been discussed in some other threats here but I don't have links now).

These are the most significant changes for now. I will give google some time to update the index and check the results of these small modifications. (I'm lucky: Google spiders about 3,5k of my pages daily).

I hope this helps some of you (and me :) to get your ranking up quite a bit.
I'll post again when I come up with further changes like an update for the file information box on the intermediate pages as mentioned above.

Cheers,
Jayhunter


P.S. Gallery at Home Theater Backdrops - Media Backdrops for your Media Center
Logged

jayhunter

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 29
Re: My five cent's on Coppermine SEO
« Reply #1 on: December 14, 2010, 07:09:25 am »

Hi again.

I already found that a link to the fullsize image with the text being the image title has a pretty big effect on google!

I used to use the "Add Pic Downlink Link" plugin (http://forum.coppermine-gallery.net/index.php/topic,65849.0.html) which adds a link to the fullsize image with the text "Save this link or open in new window." to the file information box on the intermediate page.
All my images are now listed with "Save this link or open in" as description in google image search. That is massed up for now.

To modify the file information I use the plugin hook "file_info" in a plugin instead of hacking into the main code.

Code: [Select]
    $thisplugin->add_filter('file_info','htb_fileinfo');
    function htb_fileinfo($info) {
        global $CONFIG, $CURRENT_PIC_DATA, $FAVPICS, $REFERER, $CPG_PHP_SELF;
        global $lang_picinfo, $lang_common;

        // Add title to top of info
        $add_info[$lang_common['title']] = '<strong>' . htmlspecialchars($CURRENT_PIC_DATA['title']) . '</strong>';
        $info = $add_info+$info;

        // Replace linked permalink with unlinked version
        $info[$lang_picinfo['URL']] = $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . basename($CPG_PHP_SELF) . "?pid={$CURRENT_PIC_DATA['pid']}";



        // Path to fullsize image
        $path_to_pic = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'];

        // Add download link to fullsize image
        $info[$lang_picinfo['download_URL']] = '<a href="' . $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . $path_to_pic.'">'. htmlspecialchars($CURRENT_PIC_DATA['title']) . '</a>';
       

        // Change the add to fav link to not being followed by robots
        $ref = $REFERER ? "&amp;referer=$REFERER" : '';
       
        if (!in_array($CURRENT_PIC_DATA['pid'], $FAVPICS)) {
            $info[$lang_picinfo['addFavPhrase']] = "<a href=\"addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . $ref . "\" rel=\"nofollow\">" . $lang_picinfo['addFav'] . '</a>';
        } else {
            $info[$lang_picinfo['addFavPhrase']] = "<a href=\"addfav.php?pid=" . $CURRENT_PIC_DATA['pid']  . $ref . "\" rel=\"nofollow\">" . $lang_picinfo['remFav'] . '</a>';
        }

        return $info;
    }

This of course is specific for me. It completely ignores any setting concerning access to fullsize images. So if you only give restricted access to fullsize images this function would have to be modified further.

Addionaly I copied the function theme_html_picinfo into my theme.php and changed the table to be a bit more accurate by adding thead and tbody tags, changing the descriptive td's to th's and making the alternating row format working. Just quick and dirty of course ....
Code: [Select]
function theme_html_picinfo(&$info)
{
    global $lang_picinfo, $CONFIG, $CURRENT_PIC_DATA, $LINEBREAK;

    $html = '';
    $html .= '        <thead><tr><th colspan="2" class="tableh2">'.$lang_picinfo['title'].'</td></tr></thead><tbody>' . $LINEBREAK;
    $template = '        <tr><th class="tableb %3$s" valign="top" >%1$s:</td><td class="tableb %3$s">%2$s</td></tr>' . $LINEBREAK;
    $i = 0;
    foreach ($info as $key => $value) {
        $i = 1-$i;
        $html .= sprintf($template, $key, $value, $i?'':'tableb_alternate');
    }
    $html .= '        </tbody>' . $LINEBREAK;

    return $html;
}

That's it for now. Waiting for googles spider army again ...

You can check this image of Vika Jigulina to see how the file information box now looks.

Cheers,
Jayhunter
Logged

Joe Carver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1545
  • aka 'i-imagine'
    • Home Page
Re: My five cent's on Coppermine SEO
« Reply #2 on: December 15, 2010, 01:13:57 am »

Good idea.

You might want to take another look at this line...

Code: [Select]
   $meta_nav .= "<link rel=\"up\" href=\"$thumb_tgt\" title=\"".$lang_img_nav_bar['thumb_title']. " ({$CURRENT_ALBUM_DATA['title']})". "\"/>" . $LINEBREAK;It seemed to have no effect.

Instead look at:
Code: [Select]
       '{THUMB_TITLE}' => $lang_img_nav_bar['thumb_title'],
Which seems to work when changed to: (as an example)
Code: [Select]
       '{THUMB_TITLE}' => $lang_img_nav_bar['thumb_title'] . ' ' . '|' . ' ' . $CURRENT_ALBUM_DATA['title'],


jayhunter

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 29
Re: My five cent's on Coppermine SEO
« Reply #3 on: December 17, 2010, 06:06:10 am »

You might want to take another look at this line...

Code: [Select]
    $meta_nav .= "<link rel=\"up\" href=\"$thumb_tgt\" title=\"".$lang_img_nav_bar['thumb_title']. " ({$CURRENT_ALBUM_DATA['title']})". "\"/>" . $LINEBREAK;It seemed to have no effect.

It has no visual effect, that's right. But it is included in the header and an easy way for google to figure out your websites structure.
As I think of it again, it is totally silly to include $lang_img_nav_bar['thumb_title'] here as it's generic message just repeats the intended functionality of the link relation tag.

There are some more in the theme that now look like this for me:
Code: [Select]
        $meta_nav .= "<link rel=\"start\" href=\"$start_tgt\" title=\"".htmlspecialchars($pic_data[$start]['title'])."\" />" . $LINEBREAK;
        $meta_nav .= "<link rel=\"prev\" href=\"$prev_tgt\" title=\"".htmlspecialchars($pic_data[$prev]['title'])."\" />" . $LINEBREAK;
        $meta_nav .= "<link rel=\"last\" href=\"$end_tgt\" title=\"".htmlspecialchars($pic_data[$end]['title']). "\" />" . $LINEBREAK;
        $meta_nav .= "<link rel=\"next\" href=\"$next_tgt\" title=\"".htmlspecialchars($pic_data[$next]['title']). "\"/>" . $LINEBREAK;
        $meta_nav .= "<link rel=\"up\" href=\"$thumb_tgt\" title=\"". htmlspecialchars($CURRENT_ALBUM_DATA['title']) .   "\" />" . $LINEBREAK;


I got some fresh and interesting changes today though. I really don't want error pages in the index.

In function theme_cpg_die() in file includes/themes.inc.php
Code: [Select]
// Find line (~1765)
    pageheader($msg_string);

// Replace with
   $meta = '<meta name="robots" content="noindex, nofollow" />';
    pageheader($msg_string, $meta);

Another thing I added to my displayimage.php is a way to help solve duplicate content problems.
Code: [Select]
// Find ~ line 490
    if (!is_numeric($album)) {
        $meta_keywords .= '<meta name="robots" content="noindex, nofollow" />' . $LINEBREAK;
    }

// after that add
    $meta_keywords .= "<link rel=\"canonical\" href=\"{$CONFIG['ecards_more_pic_target']}$CPG_PHP_SELF?pid=$pid\" />" . $LINEBREAK;

Google and some others (i know atleast spinn3r) do support the canonical relation tag. This will help bundling links like displayimage.php?album=1&pid=5 and displayimage.php?pid=5 just to the one unique URL and prevent lower ratings due to duplicate content big time! All In-Links and Pageranks will be summed up. This one really should be added to svn imho.

Also a nice feature would be to actually use album descriptions in meta tags.
In thumbnails.php
Code: [Select]
// Find ~ line 200
if (in_array($superCage->get->getAlpha('album'), $meta_albums_array)) {
    $meta_keywords .= '<meta name="robots" content="noindex, nofollow" />';
}

// after that add
if ($CURRENT_ALBUM_DATA['description']) {
    $meta_keywords .= '<meta name="description" content="' . htmlspecialchars($CURRENT_ALBUM_DATA['description']) . '" />' . $LINEBREAK;
}

The changes I did to the file information box look promising: Google Images now shows "Direkt Link: IMAGE_TITLE" beneath all pictures, which is not optimal but a compromise I can make for the effort spend.

That's it for now :)

Cheers
Jayhunter
Logged

hanzon2010

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24
Re: My five cent's on Coppermine SEO
« Reply #4 on: December 17, 2010, 07:41:41 am »

Thanks, will try out your changes.  SEO is indeed very important.  Not necessary probably for personal albums, but essential for business ones.
Logged

hanzon2010

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24
Re: My five cent's on Coppermine SEO
« Reply #5 on: December 17, 2010, 01:44:26 pm »

Just made the changes, no issues so far.  Will be creating the Google Sitemap now (http://www.freesitemapgenerator.com), and see how it improves.
Logged

hanzon2010

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24
Re: My five cent's on Coppermine SEO
« Reply #6 on: January 03, 2011, 11:54:30 am »

Thanks for this, works well  :)

Like if I search on Google for "Meridian G98DH", I get it on the 1st page as follows:

Meridian G98DH CD/DVD Transport - Soundscape HiFi : Used HiFi and ...
Meridian G98DH top and front. Meridian G98DH front. Meridian G98DH front and literature. Meridian G98DH side. Meridian G98DH rear. Meridian G98DH rear ...
www.soundscapehifi.com/used-hifi/thumbnails.php?album=28 - Cached

Each item description was included, as found on our Coppermine webpage:
www.soundscapehifi.com/used-hifi/thumbnails.php?album=28


Keep the SEO optimization codes coming ...  :)
Logged

profili

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 113
Re: My five cent's on Coppermine SEO
« Reply #7 on: January 20, 2011, 03:38:14 pm »

jayhunter, I saw that you have implemented a complete solution for canonical urls in your gallery. Can you share this hack with us?

Cheers
Logged

jayhunter

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 29
Re: My five cent's on Coppermine SEO
« Reply #8 on: January 20, 2011, 05:24:18 pm »

Hi profili. It is not a complete solution. It's a hack in displayimage.php, so it only applies to the intermediate view.

Another thing I added to my displayimage.php is a way to help solve duplicate content problems.
Code: [Select]
// Find ~ line 490
    if (!is_numeric($album)) {
        $meta_keywords .= '<meta name="robots" content="noindex, nofollow" />' . $LINEBREAK;
    }

// after that add
    $meta_keywords .= "<link rel=\"canonical\" href=\"{$CONFIG['ecards_more_pic_target']}$CPG_PHP_SELF?pid=$pid\" />" . $LINEBREAK;

Cheers,
Jayhunter
Logged

profili

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 113
Re: My five cent's on Coppermine SEO
« Reply #9 on: January 21, 2011, 01:04:56 am »

Thank you.

Regards.
Logged

profili

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 113
Re: My five cent's on Coppermine SEO
« Reply #10 on: February 26, 2011, 01:45:53 am »

jayhunter, can you find a solution to add canonical tag to the albums too?
Logged

jayhunter

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 29
Re: My five cent's on Coppermine SEO
« Reply #11 on: February 28, 2011, 03:24:04 pm »

jayhunter, can you find a solution to add canonical tag to the albums too?

Sure.

In thumbnails.php
Code: [Select]
// find ~ line 200
if (in_array($superCage->get->getAlpha('album'), $meta_albums_array)) {
    $meta_keywords .= '<meta name="robots" content="noindex, nofollow" />';
}

// Replace with
if (in_array($superCage->get->getAlpha('album'), $meta_albums_array)) {
    $meta_keywords .= '<meta name="robots" content="noindex, nofollow" />';
} else {
    $meta_keywords .= "<link rel=\"canonical\" href=\"{$CONFIG['ecards_more_pic_target']}$CPG_PHP_SELF?album={$CURRENT_ALBUM_DATA['aid']}\" />" . $LINEBREAK;
}

I think this is the intended usage. This will add a canonical tag to every album page that is not a meta album (as they are noindex,nofollow anyway) and link it to the album entry page.

Is that what you were looking for?

Cheers,
Jahunter
Logged

profili

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 113
Re: My five cent's on Coppermine SEO
« Reply #12 on: March 01, 2011, 01:20:20 am »

Quote
Is that what you were looking for?

Yep. Thank you...
Logged

elwave

  • Coppermine frequent poster
  • ***
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 120
Re: My five cent's on Coppermine SEO
« Reply #13 on: May 20, 2011, 03:56:44 am »

To modify the file information I use the plugin hook "file_info" in a plugin instead of hacking into the main code.

Code: [Select]
    $thisplugin->add_filter('file_info','htb_fileinfo');
    function htb_fileinfo($info) {
        global $CONFIG, $CURRENT_PIC_DATA, $FAVPICS, $REFERER, $CPG_PHP_SELF;
        global $lang_picinfo, $lang_common;

        // Add title to top of info
        $add_info[$lang_common['title']] = '<strong>' . htmlspecialchars($CURRENT_PIC_DATA['title']) . '</strong>';
        $info = $add_info+$info;

        // Replace linked permalink with unlinked version
        $info[$lang_picinfo['URL']] = $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . basename($CPG_PHP_SELF) . "?pid={$CURRENT_PIC_DATA['pid']}";



        // Path to fullsize image
        $path_to_pic = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'];

        // Add download link to fullsize image
        $info[$lang_picinfo['download_URL']] = '<a href="' . $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . $path_to_pic.'">'. htmlspecialchars($CURRENT_PIC_DATA['title']) . '</a>';
       

        // Change the add to fav link to not being followed by robots
        $ref = $REFERER ? "&amp;referer=$REFERER" : '';
       
        if (!in_array($CURRENT_PIC_DATA['pid'], $FAVPICS)) {
            $info[$lang_picinfo['addFavPhrase']] = "<a href=\"addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . $ref . "\" rel=\"nofollow\">" . $lang_picinfo['addFav'] . '</a>';
        } else {
            $info[$lang_picinfo['addFavPhrase']] = "<a href=\"addfav.php?pid=" . $CURRENT_PIC_DATA['pid']  . $ref . "\" rel=\"nofollow\">" . $lang_picinfo['remFav'] . '</a>';
        }

        return $info;
    }

This of course is specific for me. It completely ignores any setting concerning access to fullsize images. So if you only give restricted access to fullsize images this function would have to be modified further.

Whoa this bit REALLY baffled me! haha :)

You wouldn't mind explaining a bit further would you? I understand that you used a plugin hook (which is something built into Coppermine to help plugin creation, as I now understand!) but am unsure where I need to put this code?

Also thank you SO much mate all this stuff is just BRILLIANT! You have helped me loads :)

Oh also this bit:

Code: [Select]
// Find ~ line 490
    if (!is_numeric($album)) {
        $meta_keywords .= '<meta name="robots" content="noindex, nofollow" />' . $LINEBREAK;
    }

// after that add
    $meta_keywords .= "<link rel=\"canonical\" href=\"{$CONFIG['ecards_more_pic_target']}$CPG_PHP_SELF?pid=$pid\" />" . $LINEBREAK;

Am I right in saying I add the bit AFTER the if statement has ended? IE after the } ?  I'm a bit of a noob haha, but I assume that's correct!

Thanks so much and I'll keep researching. Of course if anyone else can answer these questions that's totally cool too!!


Elwave!
Logged

S73

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: My five cent's on Coppermine SEO
« Reply #14 on: February 28, 2012, 09:36:49 am »


So I took the function theme_html_img_nav_menu from include/themes.inc.php copied it into my theme.php and applied the folowing changes:

I tried to follow your advice and ended up breaking the script.
Parse error: syntax error, unexpected $end in /var/www/vhosts/mydomain/httpdocs/galerie/themes/curve/theme.php on line 831

Can't you just share the modified files here ?
Logged

S73

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: My five cent's on Coppermine SEO
« Reply #15 on: February 29, 2012, 12:55:30 am »

thank you everyone but I could find what was wrong and fixed it.

I added an unneeded if line when copying theme_html_img_nav_menu from include/themes.inc.php
Logged

S73

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: My five cent's on Coppermine SEO
« Reply #16 on: February 29, 2012, 12:57:54 am »

I use the plugin hook "file_info" in a plugin instead of hacking into the main code.

Code: [Select]
    $thisplugin->add_filter('file_info','htb_fileinfo');
    function htb_fileinfo($info) {[/quote]

any idea where I could download that plug-in?
it sounds odd, but I really could not find it.
Logged
Pages: [1]   Go Up
 

Page created in 0.047 seconds with 21 queries.