SEO of images

Permalink Browser Info Environment
I am using Touch Gallery on one site and want to use it on another. Out of the box there are no alt tags and the data-tg-desc tag is not read by search engines. I have modified view.php as follows:
[code]
<?php foreach ($images as $img): ?>
<a href="<?php echo $img->large->src ?>" style="background-image:url(<?php echo $img->thumb->src ?>);" title="<?php echo $img->title ?>" <?php if ($img->description && $showDesc) { echo ' data-tg-desc="' . $img->description . '"';} ?>><img src="<?php echo $img->large->src ?>" alt="<?php echo $img->description ?>"/></a>
<?php endforeach; ?>
[code/]

Is there a better way of doing this?

Nigel

Type: Discussion
Status: Resolved
darkmatter
View Replies:
mnakalay replied on at Permalink Reply
mnakalay
Hello,

There are a few issues in your solution.

Originally Touch Gallery doesn't use an image tag, the thumbnail is used as a background image of the link.

You have added an image, which is fine, but then you don't need to keep the background image in the link.

The second problem is that you are using the full screen image ($img->large->src) for your thumbnail. You should use the thumb image instead ($img->thumb->src)

The code would then be:

<?php foreach ($images as $img): ?>
<a href="<?php echo $img->large->src ?>" title="<?php echo $img->title ?>" <?php if ($img->description && $showDesc) { echo ' data-tg-desc="' . $img->description . '"';} ?>><img src="<?php echo $img->thumb->src ?>" alt="<?php echo $img->description ?>"/></a>
<?php endforeach; ?>


I would point out, however, that because the title attribute of the link is provided by default, you probably don't need to add an image to have an alt tag if it's for SEO sake. The title tag is perfectly acceptable for that.
darkmatter replied on at Permalink Reply
darkmatter
Ok Thank you.

I have also noticed that image urls in the gallery have file names like:

http://www.mydomain.com/files/cache/e9ae7efcdb5d3c74a014f9e383ee2d5...

As such they are not getting indexed by google images. is this due to image caching in concrete5? Is there anything I can do to change this? It is important for my 'product photos' to get indexed in google image results.
mnakalay replied on at Permalink Reply
mnakalay
This is due to the resizing of images. Any time you ask for an image to be resized, Concrete5 gives the resized version a name like that. The purpose of that gibberish file name is to make each version unique so they don't overwrite each other.

You could override Concrete5's image helper to give you a file name of the form:
original-file-name.required-gibberish-file-name.jpg

I have to say, however, that I don't think the file name impact on indexing by Google, especially if they have proper alt or title tag. According to this information (https://support.google.com/webmasters/answer/114016?hl=en) a meaningful filename is useful but not compulsory

concrete5 Environment Information

# concrete5 Version
5.6.3.2

# concrete5 Packages
Designer Content (3.1.1), Easy Tables (2.0.1), Event Calendar (0.9.4), Fancy Forms Template How-To (1.1), FlexSlider (2.2.0.5), Form Tableless Layout (1.2.1), Free Cookies Disclosure (1.0.3), Internationalization (1.3), Lightboxed Image (0.9.2), Slate Theme (1.5.3.1), Touch Gallery (1.6.3).

# concrete5 Overrides
languages/ja_JP, languages/tr_TR, languages/es_ES, languages/ru_RU, languages/da_DK, languages/sv_SE, languages/fa_IR, languages/ar, languages/ro_RO, languages/nb_NO, languages/cs_CZ, languages/zh_TW, languages/es_PE, languages/vi_VN, languages/es_MX, languages/el_GR, languages/pt_PT, languages/fi_FI, languages/nl_NL, languages/fr_FR, languages/de_DE, languages/it_IT, languages/he_IL, languages/es_AR, languages/zh_CN, languages/sk_SK, languages/sl_SI

# concrete5 Cache Settings
Block Cache - On
Overrides Cache - On
Full Page Caching - On - In all cases.
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
LiteSpeed

# Server API
litespeed

# PHP Version
5.4.38

# PHP Extensions
bcmath, calendar, Core, ctype, curl, date, dom, ereg, filter, ftp, gd, gettext, hash, iconv, imap, ionCube Loader, json, libxml, litespeed, mbstring, mcrypt, mysql, mysqli, mysqlnd, openssl, pcre, PDO, pdo_mysql, pdo_sqlite, Phar, posix, pspell, Reflection, session, SimpleXML, soap, sockets, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, xsl, Zend Guard Loader, zip, zlib.

# PHP Settings
max_execution_time - 90
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 90
max_input_vars - 1000
memory_limit - 128M
post_max_size - 8M
sql.safe_mode - Off
upload_max_filesize - 100M
mysql.max_links - Unlimited
mysql.max_persistent - Unlimited
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
session.cache_limiter - nocache
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5

Browser User-Agent String

Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.