SEO tweak

One major SEO let down of CS-Cart is empty ALT tags.



Wordpress has an addon that scans html output for empty tags and tries to fill them with at least something but to allow them be empty.



I believe that those who just start with CS-Cart are so overwhelmed that have no time to fill out ALT tags for their images, thumbnails and other. Some may even forget to fill them out that leads to empty ALT forever.



My proposal is to add logic code to image.tpl that has the following:





if $images.icon.alt is empty then

if $product.seo_name then

$image.icon.alt=$product.seo_name|replace:‘-’:’ '

else

Try to fill it with seo name of the parent folder where the product is located, or title of the item,

if that fails then fill it with general html title of the store minus any bad chars



-----------------------------------------------------------------------------------------------



I modded products_list.tpl to pass $product.seo_name and then in image.tpl I added my own logic.



[I would add my code here but it is a bit modded for other things, thus, I hope that my description of the concept is enough]



This way I will always have at least SOMETHING for the ALT. Depending on your logic, your ALT replacement can be very precise. You can even have your own function that derives proper terms for alt text, it can come from the item title, seo name, description, headers, meta or else… It would intelligently fill ALT unless you want to override it by filling out ALT yourself, otherwise leave it blank.



I chose SEO names because I have those enabled and I know I don’t have to filter them out for weird characters since it is already done, I just replace dashes with spaces.



It is an easy fix and HAS to be implemented.



PS: Similar feature can be made for metatags for that particular product page where they would automatically get filled out with derived info inside the item.



I don’t say that it is the best method to leave it automatically fill SEO for you, sure, hand picking is the best. But sometimes you forget, don’t have time, or simply don’t know what is what because you are not geeky enough… Help your customers with SEO.

This should be added.



There have been threads discussing this that date quite some time ago including these two:

[url]http://forum.cs-cart.com/showthread.php?t=16761&highlight=alt+tags[/url]

[url]http://forum.cs-cart.com/showthread.php?p=77085#post77085[/url]



it would be nice to see this addressed by the developers.



Bob

Can you post a simplified version of your code? I’m sure we could scrounge up a couple of $ for the cause.






[quote name=‘TexasGuy’]One major SEO let down of CS-Cart is empty ALT tags.



Wordpress has an addon that scans html output for empty tags and tries to fill them with at least something but to allow them be empty.



I believe that those who just start with CS-Cart are so overwhelmed that have no time to fill out ALT tags for their images, thumbnails and other. Some may even forget to fill them out that leads to empty ALT forever.



My proposal is to add logic code to image.tpl that has the following:





if $images.icon.alt is empty then

if $product.seo_name then

$image.icon.alt=$product.seo_name|replace:‘-’:’ '

else

Try to fill it with seo name of the parent folder where the product is located, or title of the item,

if that fails then fill it with general html title of the store minus any bad chars



-----------------------------------------------------------------------------------------------



I modded products_list.tpl to pass $product.seo_name and then in image.tpl I added my own logic.



[I would add my code here but it is a bit modded for other things, thus, I hope that my description of the concept is enough]



This way I will always have at least SOMETHING for the ALT. Depending on your logic, your ALT replacement can be very precise. You can even have your own function that derives proper terms for alt text, it can come from the item title, seo name, description, headers, meta or else… It would intelligently fill ALT unless you want to override it by filling out ALT yourself, otherwise leave it blank.



I chose SEO names because I have those enabled and I know I don’t have to filter them out for weird characters since it is already done, I just replace dashes with spaces.



It is an easy fix and HAS to be implemented.



PS: Similar feature can be made for metatags for that particular product page where they would automatically get filled out with derived info inside the item.



I don’t say that it is the best method to leave it automatically fill SEO for you, sure, hand picking is the best. But sometimes you forget, don’t have time, or simply don’t know what is what because you are not geeky enough… Help your customers with SEO.[/QUOTE]

[quote name=‘Tirade’]I’m sure we could scrounge up a couple of $ for the cause.[/quote]



[url]http://forum.cs-cart.com/showpost.php?p=77085&postcount=5[/url]



You can send me money…

@JesseLeeStringer - vultures! :wink:



When I’ll have a free minute, I’ll post my version.

Thank you guys for taking the time to post these codes as it’s something lots of us can take advantage of.



Stu

Please vote for the following suggestion in the Ideas forum if you would like to see empty alt tags dynamically generated for categories and products:

[url]http://cscart.uservoice.com/forums/40782-general/suggestions/698854-auto-generate-missing-alt-text-for-catalog-images[/url]



Please add your comments or suggestions in this thread.



Bob