SEO: Optimize permalinks

  • Posted on: 3 August 2008
  • By: markus.wilhelm

Thirteen Ways To Add SEO To Gallery2

Overview of Search Engine Optimization for Gallery2

I hope this is a starting point for those that want to make Gallery2 more SEO. Please remember that the SEO doesn’t make you show up higher in search listings, but makes it easier for this to happen. Having other people link to your pages is always the best thing you can do (at least for Google). Any additions to this list would be helpful. If you have questions or would like clarification, please ask.

Technical Background on Gallery2

Some of the suggestions on this list involve editing template and class files, do this at your own risk. Gallery2 administrators recommend copying the file you are editing to the subdirectory called “local” and editing the file there. Gallery2 will then use that file instead of the original. This also means that upgrades will not overwrite your edited file. In the examples below, I am using Gallery 2.2.3.

9. Optimize permalinks
Search engines do not like variables (question marks and ampersands) at the end of URLs. Gallery is made to be sticky with its items which makes human browsing easier and pretty much eliminates the need to use the browser’s back button. If you use the breadcrumbs in the upper left to view a parent album, you are shown the album page that contains the item you were just viewing. Below are changes to make to the Gallery2 code

Comment out the urlParams call in /modules/core/classes/GalleryTheme.class
LINE 1408 - BEFORE

if (!empty($theme['parents'][$i + 1]['id'])) {
$urlParams['highlightId'] = $theme['parents'][$i + 1]['id'];
} else if ($itemId && ($i + 1) == count($theme['parents'])) {
$urlParams['highlightId'] = $itemId;
}

LINE 1408 - AFTER

/* if (!empty($theme['parents'][$i + 1]['id'])) {
$urlParams['highlightId'] = $theme['parents'][$i + 1]['id'];
} else if ($itemId && ($i + 1) == count($theme['parents'])) {
$urlParams['highlightId'] = $itemId;
} */