Create ALT tags automatically for images on blogger

If you have a blog on blogger and thinking to save some time while publishing your posts, then im gonna provide a tip for you. If yours is a photo blog, then you may post hundreds of photos onto your blog.If you write ALT tags for images in each post,it may take more time if there are more images. To automate manual creation of ALT tags for images, I have written a macro,which can retrieve the image file name and creates ALT tag with that text.For this, while you create an image,provide some related description to that in the file name itself.

Note: ALT tag describes the image and increases the accessibility by search engines in their image search results.

To run this macro

1. Add below macro code in a empty MS word document

Sub autoAltTagsBloggerImage()
Dim altTextCopy
Dim i
Selection.Find.ClearFormatting
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = "<img"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Do While Selection.Find.Execute
Selection.MoveRight Unit:=wdCharacter, Count:=98

If Not Selection.MoveEndUntil(".", wdForward) And Selection.Find.Found = True Then
' Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
altTextCopy = Selection.Range.Text
'Trim (Selection.Range.Text)
Selection.Copy
'Selection.Copy
Selection.MoveRight Unit:=wdCharacter, Count:=6
Selection.TypeText Text:=" alt="""""
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.PasteAndFormat (wdPaste)
End If
Loop
End Sub

 

2. Goto blogger

3. Upload images

4. Copy its HTML code

HTML-code-blogger-post5. Paste it into the above word document

6. Run the macro

7. It creates ALT tags for all images from their image file names

8. Copy the code

9.Goto Blogger

10. Replace the existing HTML code with the copied one (in 6th step)

11. Now if you go and check each uploaded image properties, you will see ALT tag for them.

This is a simple tip, may be more useful to photo blogging sites. If you think this as useful, please share it.

About the Author

SRINI S

A passionate blogger. Love to share solutions and best practices on wordpress hosting, issues and fixes, excel VBA macros and other apps