Improving SEO by setting an image's filename as its alt or title field

Images are often neglected in SEO and they provide a great opportunity to rank well in universal search (search results such as images, video and places).

For images to rank well you need three a minimum of three things set up to target your keyword phrase:

Additionally you should add:

Adding comments into an image file can be time consuming but can usually be done by editing the properties of the image file before uploading. This can be done either in your operating system's file manager or in an image/photo editor.

Apart from the comments, everything else can be handled neatly by Drupal.

Here's what we will achieve:

Prerequisites for automatic file renaming

  1. Token‎ To provide replacement tokens
  2. File (Field) Paths‎ To rename the file
  3. Entity API‎ To provide the alt and title text replacement tokens

How to rename the image file using the alt text field

  1. Install the above modules as well as Entity tokens (included in the entity module)
  2. Add/Edit your image field and:
    • Turn on alt and title fields
    • Enable File (Field) paths
  3. Under File name options remove the file name token (leave the extension token)
  4. Check "Cleanup using pathauto"
  5. Open up replacement patterns and find Nodes >[Your image] and click [node:[your image]:?]
  6. Edit the pattern and change the "?" to alt

Now any images you upload into this field will have their filename replaced with the alt text!

Post new comment

By submitting this form, you accept the Mollom privacy policy.

User login

Author of...

  • @Casablanca Looks like a great time last night. Sorry I couldn't make it :( 12 years 29 weeks ago
  • Our new homepage is live http://t.co/iwNX1tWZ 12 years 29 weeks ago
  • Can you help with conditionally setting the 'from' in mails sent with notifications/messaging modules #drupal http://t.co/ItE75IlW 12 years 29 weeks ago
  • My post about highjacking #Drupal menu items with 'drupal_get_form' callbacks for creating popups or #ahah goodness http://t.co/Pe9wSz6k 12 years 30 weeks ago
  • Oh the conflict within. An entire section of a #drupal site was built bespoke, do I add a bespoke subsection, or rewrite the entire section? 12 years 33 weeks ago
  • @psd It depends. Serving static pages means https has a larger relative impact. If there's a lot of processing, https is relatively small. 12 years 34 weeks ago
  • Just had a play with the #drupal Field collection module. goo.gl/p6sEn A really nice Drupal 7 implementation of the multigroup module. 12 years 34 weeks ago
  • @philhawksworth @a_alfredo When will scampcat have the descriptions pop up when you hover over the markers? 12 years 34 weeks ago
Oliver Polden