WordPress NextGEN Gallery – SEO Permalink Patch

WordPress LogoAfter converting my gallery from Coppermine to NextGEN, one of the only downsides was the non-SEO friendly nature of NextGEN’s default permalink structure.

After searching through Google, its seemed others had also raised the issue, but the feature was as-yet unimplemented by Alex Rabe, NextGEN’s developer. Undaunted by this, I set about dismantling NextGEN’s code to implement it myself.

So, after several hours of coding, hacking and bug-fixing, I have released the changed files for anyone who wants to implement the feature in the future. Just download the patched version of NextGEN (tar.gz | zip | changed files only) and replace your current NextGEN plugin files. You will need to update your permalink structure once after activating the SEO settings in the NextGEN Options page.

Disclaimer

Obviously there is a risk in using this as it I haven’t tested on anything other than my own website. Remember to backup your current nextgen-gallery plugin folder, as well as any customised CSS files you have.

I have submitted the changes to Alex, so hopefully they should be integrated into the next release of NextGEN.

If you have any questions/comments, please by all means ask :)

Update 21:00 BST, 8th July 2010

I have been testing the changes and have found a couple of minor bugs, mainly relating to the use of European characters and quotes in gallery/album names. These bugs have now been fixed, and a proof-of-concept for European characters is here.

The archives above have been updated to include these changes. If anyone can provide feedback (even a “it works!”) it would be much appreciated – I’m trying to save Alex as much testing as possible :)

How To: Backup with SSH and Rsync

PuTTY logoMy websites (hosted with EvoHosting) are incrementally backed up to a server running on Atlantis – my VMware ESXi host – for the dual purposes of offline development and data resilience. I’m fairly sure that there are numerous guides out there already to accomplish this, but hopefully this will be useful for some.

For ease of explanation, I will skip any network configuration, though if anyone would like detailed configuration on NAT, port forwarding and dynamic DNS, please by all means leave a comment or email me.

SSH Key Configuration

The first thing to do is to configure SSH key authentication, so that your source server can login to your backup server without being prompted for a password. Run the following command on your source server:

ssh-keygen -t rsa

Copy this key into your authorized_keys file (usually in /home/$USER/.ssh) on your backup server and set permissions to 700 so that nobody else can read or edit the file – these permissions are explicitly required for most SSH installations, so double-check that they are correct.

Rsync Configuration

After looking around for help on rsync for a while, this is the rsync command I have come up with:

rsync --delete  -ae 'ssh -p999' /home/craig/public_html/ backup.network.local:/home/craig/public_html/

The “delete” option tells rsync to delete files on the backup that aren’t in the source, and the -p999 option tells SSH to use port 999 for the transfer – I used this as I use a non-standard port for SSH for security, however if you run SSH on its standard port (22), you can remove the -p option.

MySQL Backups

Although Rsync will copy my public_html directory, it won’t backup my MySQL databases. To do this, I used the mysqldump utility. Unfortunately my file permissions wouldn’t allow me to use the more efficient mysqlhotcopy utility, so I have had to make do with a slightly crude full backup, which is gzipped to keep the file size minimal:

mysqldump --all-databases | gzip > ~/databases.sql.gz

This full backup is then imported back into the backup server’s MySQL databases.

Automation via Cron

All that was left to do after this was to schedule the backups automatically via each server’s cron scheduler. The MySQL database imports take place 45 minutes after the Rsync copy to give the backup time to complete.

Where needed, I have written simple Bash scripts to simplify the process and to remove the backup SQL scripts after transfers and imports.

~~

Hopefully that has been educational, please feel free to comment if you have questions/suggestions :)

Website Revamp!

I have now converted the whole website to run the WordPress blog software, including a slightly more professional look acheieved by combining my previous design with Pyrmont V2 WordPress theme!

An added bonus of using WordPress is the SEO-friendly URLs, like the one you’re viewing right now. Hopefully the site should be a lot more streamlined – if you see any glitches or problems, by all means comment or email me :)

I still need to convert the Coppermine gallery over to the same theme, but hopefully that should be done over the next couple of days – depending on how nice Coppermine wants to be!

SEO: The Web’s Holy Grail

The Google Logo

With companies spending hundreds – if not thousands – of pounds these days on marketing and advertising, it’s not just enough to have “a website” out there somewhere in the ether; it has to be easily found by the average user, and this means it has to be optimised for the lean, mean search engines that crawl and index millions of websites on a daily basis.

In this blog I won’t be going into detail on the intricacies of Search Engine Optimisation (SEO) but I will cover some of the tips I’ve picked up over the last few years that may be some help.

1 – Write Good Code!

Too many websites use bad/unreadable/invalid code that does display the website correctly in the vast majority of browsers, but is very hard for a search engine (like Google) to crawl and understand. Search engines see only the (X)HTML markup of the page, without any formatting controls like CSS (whether in-line or external) – they don’t see the graphics and layout that you and I see.

The most efficient way to combat this is to write clean, efficient and valid code that separates content from presentation by using CSS to control formatting and XHTML to control layout. Tables should be used for displaying data, while <div> tags should be used for content separation. Sticking to the W3C XHTML specification (either the Strict or Transitional DTD) is key to this, as it allows all websites to comply to a central standard. Making sure your website is valid code isn’t just for completeness, search engines care about neat code as well because it makes their jobs easier.

2 – Be descriptive!

Following on from point 1 above,  be as descriptive as possible with both your alternate image text and link text. Because search engines only see text, all images are converted to their text equivalent, which is defined in the XHTML code as the “alt” attribute within the <img> tag. Being more descriptive in your alternate text helps the crawlers to understand and index your website more easily. It also allows your images to be indexed by specialist image crawlers (for example Google Images), opening up more entry points into the website.

Try not to use the classic “click here” for hyperlinks for the same reason. More descriptive link text not only helps the search engines, but also helps your user in deciding what links are worth clicking.

3 – Use Links Wherever Possible

A good trick I use quite a lot is to put a link back to the website’s homepage and either my personal website or my freelance portfolio in the footer of the page. This creates both an inbound link to the target website and an outbound link from your website, and increases the number of pages your site relates to in the eyes of crawlers, therefore giving you slightly better rankings.

XHTML Text

4 – Use <meta> Tags!

The use of <meta> tags to describe the content and purpose of the website varies slightly between browsers and crawlers. Some crawlers just look for <meta> tags, others crawl the entire page and index content, some do both – so try to make those <meta> tags as descriptive and representative as possible. The “keywords”, “content” and “author” flavours all have different roles, and any websites putting random words into the “keywords” tag in the hope of getting hits for unrelated keywords will be ranked down, as well websites with unrelated “content” tags, so try to be as on-topic and relevant as possible.

5 – Choose a Good URL!

It’s extremely important to choose a URL that reflects the topic of the website, as search crawlers try to tie these two together. Long addresses will be harder for visitors to remember, so a balance is needed between descriptiveness and length. If the name you want is taken (and it often is), try looking for other Top-Level Domains (TLDs) like .org and .co.uk instead of the obvious .com, although .org domains are generally used for non-profit organisations so it’s generally a good idea to keep within the intended use for the TLD if possible.

————————

Hopefully the above points have enabled you to optimise your website and get it further into the rankings without going into too much detail. The key thing to remember however is that SEO is by no means an exact practice. It may take day, weeks or months for a crawler to index your website and even longer for it torise up the rankings, so have patience!

A Very Belated Update

So where has the last six months gone??

It seems like only yesterday I was packing my gear in Aberystwyth. Since then, I’ve moved back to Essex, packed in a fair few We Will Rock You shows, redesigned this website, played bass in a variety show concert started a new job and and built a brand new desktop PC – so it’s been “all go”!

The new desktop PC has been about a month in progress but it’s finally completed and I couldn’t be more pleased with how it’s turned out. More details are on the Computers section of this site, so I won’t bore people with techncial specifications here, but it’s safe to say that it was definitely worth the effort!

September 20th saw a parial change of cast for We Will Rock You at the Dominion. Among those to leave were Julian Littman, Lain Gray and Lucy Sinclar who play Pop, Vic and Meat respectively. I have yet to see the new cast, but I’m sure they will be brilliant.

I’m now working at Colchester Sixth Form College as an IT Technician as part of my degree course’s Year in Industry. It started pretty slowly, then sped up quite a bit as staff and students were off for the summer, freeing up the servers and network for maintenance. Hopefully it’s calming down slightly now!

The aforementioned variety show was the brainchild of Hans Montanana, the former head of music at Rickstones School who I’ve kept in contact with over the years. I actually came out of semi-retirement as a bassist to play the concert, not having played seriously for over three or four years! It was definitely a challenge going back to basics and reading from chord charts again but hopefully I’m now back into the swing of it and the next one (if there actually is a “next” one) will be a bit easier!

Last of all, I’ve given this website a bit of a revamp and redesign, and added a new section dedicated to the building of my new desktop PC. The theme of the redesign was partially inspired by the recent events at CERN and the Large Hadron Collider, I’m still not 100% happy with the design so there may be a few further tweaks in the next few weeks!

Anyway, that’s your lot, apologies for not updating over the last 5 months but it has been pretty action-packed!

Up the ‘kin Irons!
Craig