Using metadata to create relevant filenames for SEO

Lightroom tricks for changing filenames in bulk

Posted on 7th April 2022 in .  So far there are No comments

A little background first. An existing commercial client got in touch to ask if I had a specific sort of image from one of the events I have been to for well over ten years. In other words, lots of images to choose from.

The brief was a little vague so I browsed through some of the thousands of images I had of the event using Boolean keywords to narrow down the search on my web site. I knew I had something very close to the brief but couldn't remember which year it was from, so searching using things like "water NOT showjumping NOT dressage" using Photodeck's Media Library > All Files interface enabled me to narrow down around 8,000 images to a little over 2,000 and they were relatively straightforward to browse through quickly.

The importance of filenames

I started to copy the file names of a few images which I thought fitted the brief quite well into an email to the client, but realised in the process that a few of them - from one particular year of the event - did not have SEO-friendly filenames.

I bang on about image metadata all the time but the truth remains that a lot of commercial clients search for images online, and if your website and filenames are not SEO friendly then your images are unlikely to ever show up in those searches.

It's all very well having a human-friendly file structure on your website but search engines send automated bots to do that searching for them, and they can't scan the images like the human eye can. For search engine robots it is important that the images files themselves contain descriptive metadata so that the bots can record that and index it.

Let me give you an example.

Your website is structured logically so that your folder tree makes sense to a (sighted) human visitor:

  • Sport > Event Name > Year > Section

When a human visitor reaches the Section folder the thumbnails speak for themselves and the visitor can browse for what they are looking for.

If a search engine robot finds the Section folder then the next thing it sees is files with names. These names are useful to the robot, enabling it to store some sort of text in its index.

If our filenames are in the form DSC_876453.jpg or similar then the robot doesn't get much information about what the image contains.

If we are lucky then we are using a platform for our website which uses image metadata intelligently.

For example, Photodeck looks at the image metadata and uses the IPTC Title or Headline field as the HTML Meta Title for the page that it uses to display that image. The IPTC Caption is used to fill out the HTML Meta Description. Photodeck also prints a great deal of other IPTC metadata on an image overlay which the human can read if they choose but is usually hidden by default.

If a human has clicked on a thumbnail to view it larger then they won't see that this has happened (unless they want to check, in which case they can hover their mouse over the browser tab).

A search engine robot following the same link doesn't see the enlarged image - it is only a computer program after all - but it does see that HTML Title and Description fields, and the other metadata which Photodeck has printed to the page also gets read and indexed.

A job half done

Back to my search.

My images from 2014 had some of the metadata added, the important stuff like the name of the rider and horse they were competing on. The Caption/Descriptions also contained a summary of the event using the classic wire agency mantra of "all the Ws": What, Where, When, Who, Why?

Hopefully, therefore, a search engine robot would have been able to see some of that data BUT my filenames made no logical text sense because they were in their original form along the lines of NJM_324736.jpg.

What we want a search engine to see is a meaningful file naming policy like rider-horse-event-date.jpg.

I use Lightroom's Publish plugins to publish files directly from Lightroom to Photodeck, so if I changed the filenames in my catalog and then republished them then all would be well.

The problem was that there were 1500+ images whose filenames needed to be changed and each needed to reflect the contents of that particular image. There were also several images of each horse and rider combination, so they needed to be sequentially numbered to ensure they had unique filenames.

Changing filenames - Lightroom to the rescue

Yes, you don't hear me say that very often! As it happens, Lightroom has some useful tools for changing filenames of images.

As part of my usual workflow I use Lightroom's file renaming tool. I make the first part Custom Text, which I change for each group of images of the same rider and horse. After this comes the name of the event and finally the date on which the image was taken. This last bit is not very significant for search engines but is useful to me when people make an order and I have to source the original file in my catalog of nearly 750,000 images.

In this case I don't want to repeat this process for each rider because I don't have a day or two to spare to do it but luckily there is a slightly less than perfect way to do it very quickly.

I told you that I had completed most of the metadata back in 2014. The important bit of this was that the Title and Headline fields contained the name of the rider and horse. We can use this data in the renaming dialog.

If you select something like the Custom Text and Sequence preset but then click on the Edit option at the bottom of the dialog then you have a whole bunch of options which I rarely explore.

Among these is the option to automatically insert the contents of an IPTC field data into the filename.

The images I needed to change were taken on three consecutive days so I used the Library search tools to narrow down the catalog images for each day at a time then renamed them using this pattern:

{Headline}-{Sublocation}-6May14-{Sequence 001}

I could easily have used {Custom Text} in place of {SubLocation} if I had wanted to create a custom part of the filename, or indeed {Title} in place of {Headline} if that is where I had stored my simple image description.

Now, I said it was slightly less than perfect and here's why.

The IPTC Headline field contained spaces e.g. John Smith and SUPER NAG. The file renaming pattern doesn't have the power (please correct me if I'm wrong) to remove these spaces and replace them with hyphens, which are allegedly better for filenames on the internet.

As a result the filename ended up as John Smith and SUPER NAG-Badminton-7May14-001.jpg.

This is still much more useful to a search engine robot, and for the five minutes it took to rename and republish the files, well worth it even if only one sale results.

Changing filenames - a better way using a powerful plugin

I would highly recommend the Photographer's Toolbox plugins for Lightroom. There are some incredibly useful Lightroom extensions among them which can make day to day life easier and get your out of trouble when something needs correcting.

In this case the Search Replace Transfer Lightroom Plugin by John Beardsworth has the perfect tools to help us get this job done more efficiently, but we have to be smart about it.

Lightroom doesn't allow us to search and replace in the filename, so we can't replace the spaces in our first attempt using hyphens. That would have been nice.

Instead I use a blank metadata field as a temporary storage place for my filename as I use the plugin to perfect the text which it contains. Then we will use this metadata field in Lightroom's file rename dialog.

First, in Lightroom, I select all the images I want to create a new filename for. In my case there are 250 in a folder from the event.

Then, from the Library menu, I select Plug-In Extras, then Search, replace, append and transfer.

If you missed the step where you select all the files, you will now be asked if you wish to work on just one file or all of them. There really is no point in going through these steps for one image, you might as well just hit F2 and type out the filename yourself!

In the dialog box which opens go to the Transfer tab. This allows you to copy metadata from one IPTC field to another and choose whether it should replace what is already there, go before it, or after it.

IMPORTANT: choose a field which is empty or not important, in case you forget to empty it at the end of the process. I'm using the Creator Job Title field, which I never use with my images.

Transfer headline using lightroom plugin

I've selected the Headline field as my source - this is also the field which becomes the page title for this image on my website.

I've selected the Creator Job Title field as the destination.

I've chosen to replace the existing data if there is any - there isn't so this has no effect.

At the bottom there is a preview which shows that before this transfer takes place there is nothing in the Target field for the first image, and shows what will be there when the transfer is complete. I can use the navigation buttons to move through the 250 selected images to check the results if I wish to.

This all looks good so I click the button which says Transfer between fields 250 item(s). Don't give in to the instinct which says that the "go" button is at the bottom of the dialog box. You will see Lightroom working in the background but it won't take more than a second or so.

Now change the tab at the top of the dialog to the search + replace tab.

Make sure that the Target field is now Creator Job Title (or whatever you used) and change it if necessary.

Replace text is the Method we want.

In the preview I can see that the text in the field is way too long to be a filename so I am going to search and replace the bits I don't want, starting with the second half from the hyphen onwards:

Search replace plugin dialog

The Replace with box is left empty.

I can see that this is going to strip off the event info from the end and leave me with just the rider and the name of his horse. We can add a simplified event element later.

Click the Search and replace 250 item(s) button and our work will be done.

Now click in the Search for field and replace the text there with a space. This time replace the space with a hyphen:

Search for spaces and replace with hyphens

I don't like to include common words in the filename so I will repeat this one more time replacing "and-" with nothing.

Done. Now we can use the resulting Creator Job Title field in our filename.

Close the plugin dialog and hit F2 on the keyboard to open the Rename Photos dialog.

From the File Naming drop down box choose Custom Name - Sequence. Now type in what you want to appear at the end of the filename, after the rider and horse details:

changing filenames using a custom pattern

as we want to add to the filename, we now click the File Naming drop down again and choose Edit... from the bottom of the list.

This dialog will now appear.

changing filenames by editing a custom pattern

Carefully click with your cursor a the very start of the editable box, ahead of the first curly brace.

From the Metadata section, click on a dropdown and find and select the field we used to create our text, Creator Job Title. Click Insert to add it to the filename pattern where our cursor was positioned.

rename with extra field

Looking at the example given this now looks perfect. No spaces, and a sequence counter so that no two files have the same name.

This could be useful again so before you click Done, go to the top dropdown again and Save Current Settings as New Preset with a name you will remember next time.

Finally Click Done, and then OK to rename your files according to the contents of their metadata.

Congratulations. You now have files which make sense to humans and computers alike. What's more, when you have done it a few times the whole procedure takes a few seconds.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About Nico

I am a photographer, website designer and hosting provider living in Oakham, Rutland.

I work with clients who are sole traders and others which are FTSE companies. They are equally important to me.

If you need commercial photography, editorial photography, event photography, lifestyle, equestrian or wedding photography, then I can help you, with over 30 years experience in these areas.

I also teach photography, both one-to-one and in small groups. I mentor photographers with a range of experience, from beginners to working professionals.

I have a varied set of skills, having worked for well known web design and...
...web analytics companies in parallel to my photography.

I design, host and maintain websites for clients as varied as farms, interior designers and equestrian centres, as well as for bloggers and sportspeople.

I am the Public Relations Officer for the Midlands Point-to-Point Association, a role which utilises my PR and social media skills to promote horse racing both online and in the National press.

If you think that I could be the right person to help you, whatever your project, then please get in touch and we can discuss what you need and the ways in which I can help.

You can find out more about me here.
Rutland Photographer | Photographer in Oakham | Leicestershire Photographer | Web Design Rutland | Web Design Oakham | SEO Rutland | Commercial Photographer Rutland

Green Hosting by Kualo
© Nico Morgan 2021
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram