Image SEO on a Multi-Language Site


#1

We use kirby2 on our multi language website with tons of images. The site is performing well in search engines, as we have good original content and we are around for a while. However it is hard to find our images in any image search at all.
Investigating this I found out that the image file name is one of the more important aspects. You should ideally name your image /path-to-image/my-search-term.jpg
Here comes the problem: In a multi-language environment the image files under the different languages all point to the same file (name). So it is not possible to have
language 1 …/my-search-term-in-language-1.jpg
and
language 2 …/my-search-term-in-language-2.jpg
Does anybody of you care about this problem? Is there an (obvious) solution out there? Or (second best:) is there a way to program this into a plugin?


#2

Google loves structured data. As far as I know, the images file name should be in the sites primary language. from there you can use structured data in JSON format that you can easily populate from image meta data to feed Google multilingual alt tags and captions. The provide a rough overview here. You might be better off asking this question on somewhere like Stack Overflow.

You might be able to use Kirby’s router to change the filename based on language “virtually”, but it will ultimately land on the original file name.


#3

Basically you are saying that the ALT image atribute has the same value for search engines than the file name. I find that not true for some examples I have checked. The ALT atribute was not even always present at all.
Thanks for the hint to Kirby’s router. I will check on this.


#4

Thats not what I meant. The alt tag is extra data that should be present (but often isn’t because people forget) and it should be translated if you can. The file name should be something meaningful like the pages title or the name of the product or whatever it is.

For example, if its of an Phillips Electric Razor, don’t just call the image “phillips-razor.jpg” because “phillips-electic-razor-x500c-waterproof.jpg” is much more useful. This would be better then a search term because it effectivly describes the subject of the image, and will catch multiple search terms. Do the same trick with the alt tag.


#5

yes, I understand. But for a multi language site the image name will remain in the default language for all other languages as well. Can that be changed with Kirby’s router as you mentioned?


#6

Quite probably. It can be used to manipulate URLs based on a pattern or some condition. You would need to tell it the desired filenames somehow. You could probably do that with a structure field in the meta file for the image. Use the language codes in the structure so you can pick up on the language the site is being used in and match it up to the correct key in the structure field, so it is stored like this…

en: englishfilename
de: germanfilename
it: italianfilename

Then you can trim the filename before the file extension and replace it with the structure field value.

The other way is to use a file hook to generate the other images with correct filenames and use the router to hit the correct one, but you will end up with lots of files that way.

I have never used the router on files though, maybe @texnixe can help more here.


#7

I understand, that the router can change the name of the file called in the src tag. However does it also change/copy/move the name of the physical file that is adressed in the src tag?


#8

No it just tells Kirby that if a browser request for “apple.jpg” comes in, it should serve it as “cherries.jpg” but only “apple.jpg” physically exists on the file system. So your logic in english would be something like…

if the language code is DE and request is for “apple.jpg”, check that “apple.jpg” exists, and apple.jpg = cherries.jpg, elseif the language code is IT… you get the idea.

Its basically a URL rewrite that you can control with logic.


#9

an alternative to URL rewriting to achieve this:
I remember we have written our own function in a plugin, that generates the images. It would most likely be possible to use it to generate and address different file(-names) for different languages. For anybody interested in our image function I am happy to post it.