Gallery2 titles and keywords search engine optimization script

If you are interested in the open-source image gallery web application, Gallery, you have probably read the Thirteen Ways To Add SEO To Gallery2. If you haven’t, then read that tutorial first. Within that tutorial, I mention a bulk renaming script that I have used for years with Gallery2 to change titles and keywords. This post is about that title and keyword generating bulk script. It removes some common naming conventions from the titles and removes common words from the keyword list. Do people really want to see all the photographs that contain the articles, “a,” “an” and “the.” I certainly wouldn’t.

The default title for Gallery2 item uploads is the file name of the image. It easier to name your files well from the beginning from the safety of either than edit the URL, titles, and keywords for your item after they are uploaded. My naming convention for a file name is photo_set-photo_subset-people_or_objects. For a photo of my parents, my bride and myself at my wedding, I used “wedding-party-parents-rachel-stephen.jpg”

When creating titles this script does the following via regular expressions:

  • Removes ‘copy’ (a common OS-X filename suffix)
  • Removes underscores at beginning
  • Removes underscores at end
  • Removes double underscores
  • Removes left and right parenthesis
  • Removes all single digit numbers and letters
  • Replaces underscores and hyphens with space

When creating keywords from titles, this script removes the following common words and inserts commas between the remaining words:

a, about, above, across, act, add, after, again, against, all, along, also, amid, among, an, and, any, are, around, as, at, back, be, been, before, behind, below, beneath, beside, besides, between, beyond, but, by, came, can, cause, change, close, come, concerning, considering, could, cover, cross, despite, did, differ, do, does, down, draw, during, each, even, every, except, excepting, excluding, far, few, find, follow, following, for, found, four, from, get, give, go, grow, had, hard, has, have, he, her, here, high, him, his, how, if, in, inside, into, is, it, just, keep, know, large, last, late, left, let, like, little, long, look, made, make, many, may, might, minus, more, most, move, much, must, my, near, never, no, now, of, off, on, one, only, onto, opposite, or, other, our, out, outside, over, own, part, past, per, plus, put, regarding, right, said, same, saw, say, see, self, set, she, should, side, small, so, some, still, such, take, tell, than, that, the, their, them, then, there, these, they, thing, this, three, through, to, too, toward, towards, try, two, under, underneath, unlike, until, up, upon, us, use, versus, very, via, want, was, way, we, went, were, what, when, where, which, while, who, why, will, with, within, without, would, you, your

Usage

You can either edit the setup variables in the script or use URL variables (such as “?field=g_keywords&begin_id=3000″). That example would insert keywords (test insert, not commit) based on the titles of all items after item 3000.

Requirements

  • Some familiarity with the PHP language
  • Login credentials: server, username, database name, password
  • Item ID to begin with (default is 0, that is “all items”)
  • If you want to change my default title word removal listed above, familiarity with regular expressions

Download Gallery2 titles and keywords SEO script

NOTE: You will need to rename the “.txt” file to “.php” in order to run it on your server. Also this script will edit not only item names, but also albums. I’ve included copious comments in this script to aid in customizing it to your needs.

If you have found this post valuable, please share it with others: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Facebook
  • del.icio.us
  • Google
  • StumbleUpon
  • TwitThis

A note about the author

Photograph of Stephen JamesMedia designer with experience in interactive, print and video. I have a marketing and advertising agency background and currently work full-time at a full-service agency. Visit my contact page, even if you would just like to say hello. To stay in touch, follow me on Twitter or connect on a variety of other social networks. Thanks for stopping by!

One Response to “Gallery2 titles and keywords search engine optimization script”

  1. Posts about SEO as of January 13, 2009 | The Lessnau Lounge Says:

    [...] about SEO as of January 13, 2009 Gallery2 titles and keywords search engine optimization script – smjdesign.com 01/13/2009 If you are interested in the open-source image gallery web application, [...]

Leave a Reply


My Sites