Hello,
My website will be translated into several languages and want to ask you what is best for SEO.
My website has the following structure: website.com/en, website.com/ru. If both languages are important for me, then how should I write the names and alt tags and description?
Should I use the cyrillic for the names or their equivalent in latin?
From what I’ve read so far I know there are two-three options but don’t know which is correct for GRAV. One of them is to duplicate the images with different names but in such case won’t that be duplicate content?
I also have bought different domains and I wonder if I should use them. What if I want to optimize images for different countries / regions?
I am a photographer and I have many images, so it’s very important for me. I’ll appreciate any help.
@Krassie I’ve tried a few things for you, but haven’t been able to come up with a good solution with respect to unique filenames.
Filenames:
A descriptive filename for an image is indeed valuable for SEO, but I can imagine that copying all images for all languages isn’t always a doable option. The filename is not the only aspect though, also title and caption are important for pageranking.
Instead of copying/renaming filenames, I have tried Grav’s routing settings in ‘site.yaml’. Like:
routes:
/image1-en.jpg: '/path/to/image/image1-ru.jpg'
/image2-en.jpg: '/path/to/image/image2-ru.jpg'
Although the routing works perfectly for pages, I haven’t been able to get it working for images. Maybe it is not supported for images, or I am doing something wrong…
Titles, caption, alt:
Each image can have an ‘attached’ meta file like ‘image1-ru.jpg.meta.yaml’ (stored in the same location), in which any data about the image can be stored. If a title is stored in the file, it can be retrieved in Twig using ‘image.meta.title’. Since it is just yaml, you could store anything. For example:
ru:
title: my-russian-title
alt: my-russian-alt
caption: my-russion-caption
en:
title: my-english-title
alt: my-english-title
caption: my-english-caption
Your Twig could then look like:
{% set image = page.media['image-ru.jpg'] %}
{% set lang = grav.language.getLanguage %}
<figure>
<img src="{{ image.ur }}" title="{{ image.meta[lang].title }}" alt="{{ image.meta[lang].alt }}">
<figcaption>{{ image.meta[lang].caption }}</figcaption>
</figure>
Above code is from the top of my mind, so it might contain some imperfections… I hope the idea is clear though.