exnatural Posted September 24, 2013 Share Posted September 24, 2013 Hi there! Anybody knows a way to add title tag to images with a code modification? I mean getting the information from meta title pages. Sure the words it takes are not the best for SEO, but can help saving a lot of hours and then retouch Thanks! Link to comment Share on other sites More sharing options...
NemoPS Posted September 25, 2013 Share Posted September 25, 2013 Hi, which images would you like to target? On the single product view? Link to comment Share on other sites More sharing options...
exnatural Posted September 25, 2013 Author Share Posted September 25, 2013 Hi, which images would you like to target? On the single product view? I'd like to target as much images as possible. I forgot to insert title tag on images so now I have 12.000 without. Link to comment Share on other sites More sharing options...
NemoPS Posted September 25, 2013 Share Posted September 25, 2013 Well it really depends on where you want to add them, if it's in descriptions, there is nothing you can do but adding them manually. If you are talking about product images, it's possible to edit the template files and add a standard title for all of them, depending on the page you are seeing/element being displayed Link to comment Share on other sites More sharing options...
exnatural Posted September 25, 2013 Author Share Posted September 25, 2013 Looks like a great saving of time, many of the images that I need to fix are product images. Are you talking about the product.tpl or other files? Link to comment Share on other sites More sharing options...
NemoPS Posted September 25, 2013 Share Posted September 25, 2013 For the single product view, yes, product.tpl. Basically, in the views_block element, if you look for <img id="thumb_{$image.id_image}" src="{$link->getImageLink($product->link_rewrite, $imageIds, 'medium_default')}" alt="{$image.legend|htmlspecialchars}" height="{$mediumSize.height}" width="{$mediumSize.width}" /> You can see it refers to the image legend in the alt property. Since you haven't added any, you can replace it with {$product->name} Or any other tag you like 1 Link to comment Share on other sites More sharing options...
exnatural Posted September 25, 2013 Author Share Posted September 25, 2013 Very cool hack, I will try as soon as a have the computer Thank you Nemo1 !! Link to comment Share on other sites More sharing options...
exnatural Posted September 25, 2013 Author Share Posted September 25, 2013 Only to be sure.. I see you are telling me about the alt tag, but I'm looking to add the title tag on images. I have already all images with the alt attribute So I think I have add to this: title="{$product->name}" to line: <img id="thumb_{$image.id_image}" src="{$link->getImageLink($product->link_rewrite, $imageIds, 'medium_default')}" alt="{$image.legend|htmlspecialchars}" height="{$mediumSize.height}" width="{$mediumSize.width}" /> In this way: <img id="thumb_{$image.id_image}" src="{$link->getImageLink($product->link_rewrite, $imageIds, 'medium_default')}" alt="{$image.legend|htmlspecialchars}" title="{$product->name}" height="{$mediumSize.height}" width="{$mediumSize.width}" /> Is this good? Thank you. Link to comment Share on other sites More sharing options...
NemoPS Posted September 25, 2013 Share Posted September 25, 2013 Images should not have a title tag. Only links should, as per W3C. So, if you want to add the title tag, you can add it to the link sorrounding the image Link to comment Share on other sites More sharing options...
exnatural Posted September 26, 2013 Author Share Posted September 26, 2013 I'm using Raven Tools, it warns me about the title tags on images, do you think is not a good idea? I think not all images has a link to put the title tag there, but I'm not sure.. Link to comment Share on other sites More sharing options...
NemoPS Posted September 26, 2013 Share Posted September 26, 2013 As far as I know, images should not have it but anyone please feel free to correct me the alt tag is fine anyway, don't worry! Link to comment Share on other sites More sharing options...
Recommended Posts