stopping image alt tag from being the file name

General ShopSite user discussion

stopping image alt tag from being the file name

Postby psldesigns » Fri Mar 30, 2012 11:01 am

In order to customize the alt tag of an image i have the alt information in PRODUCT.Field11 and in the template i have the following:
Code: Select all
<img [-- PRODUCT.Graphic Remove_HTML --] alt="[--PRODUCT.Field11--]


The results i get when i view source are the following:
Code: Select all
img  src="http://www.kidschristmasornaments.org/media/OWKIDS12150D.jpg" alt="OWKIDS12150D.jpg" width="250" height="297" vspace="3" hspace="3" border="0" alt="Nautilus Shell Beach n' Sea - Kids Ornaments">


Notice that there are two alt tags ... the one shopsite generates (file name) and the one i want. I don't think google will be happy with this. Is there a way to supress the alt tag that ShopSite is generating?

Thanks.
psldesigns
 
Posts: 116
Joined: Wed Aug 16, 2006 7:06 pm
Location: Michigan

Re: stopping image alt tag from being the file name

Postby ShopSite Lauren » Fri Mar 30, 2012 11:08 am

I believe that if you FTP the images into your ShopSite store rather than use the image upload option in the back office of ShopSite, that the alt tag will not be there (I am not positive on this, but this is what I seem to remember). Another option would be to change your template. If you are not using the resize image feature at all (or if you are, if all your images are in the /media folder, not a subfolder), then you could change your template to the following:

<img src="[-- OUTPUT_DIRECTORY_URL --]/media/[-- IMAGE PRODUCT.Graphic --] alt="[--PRODUCT.Field11--]">
- ShopSite Lauren
Contact me for help with any of your
custom ShopSite template questions.
ShopSite Lauren
 
Posts: 889
Joined: Fri Aug 11, 2006 1:35 pm
Location: Orem, UT

Re: stopping image alt tag from being the file name

Postby Jim » Fri Mar 30, 2012 11:10 am

Alt tags for images is configured on Images > Select the image > Edit images

If you want to do it a different way you should create the entire image tag using [-- IMAGE product.graphic --] to just get the name (and path) of the image and then add your field with attributes. (or just leave the Alt= out of the field where you are configuring the other attributes.)
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: stopping image alt tag from being the file name

Postby psldesigns » Fri Mar 30, 2012 1:09 pm

I edited Lauren's method slightly which worked ...
Code: Select all
<img src="[-- OUTPUT_DIRECTORY_URL --]/media/ss_size3/[-- IMAGE PRODUCT.Graphic --]" alt="[--PRODUCT.Field11--]" border="0">


My question now is there some way to use the size picked for the product instead of hardcoding the ss_size3. I was thinking [-- PRODUCT.ImageSize --] instead of the 3 but it erred out. Is there some way to incorporate that tag?
psldesigns
 
Posts: 116
Joined: Wed Aug 16, 2006 7:06 pm
Location: Michigan

Re: stopping image alt tag from being the file name

Postby ShopSite Lauren » Fri Mar 30, 2012 3:46 pm

no, you have to hard code it the way that you have in your code.
- ShopSite Lauren
Contact me for help with any of your
custom ShopSite template questions.
ShopSite Lauren
 
Posts: 889
Joined: Fri Aug 11, 2006 1:35 pm
Location: Orem, UT

Re: stopping image alt tag from being the file name

Postby psldesigns » Fri Mar 30, 2012 3:59 pm

Is there a way to do the same thing on a page template with the PAGE.LinkGraphic? Doesn't seem to work the same way. This
Code: Select all
<img src="[-- OUTPUT_DIRECTORY_URL --]/media/ss_size1/[-- IMAGE PAGE.LinkGraphic --]" alt="[-- PAGE.LinkName --]" border="0">

produces the following result:
Code: Select all
<img src="http://www.christmasornamentshop.org/media/ss_size1/media/HOME-babys-first.jpg" alt="Baby's First Christmas Ornaments" border="0"></

notice the two media directories.
And this:
Code: Select all
<img [-- PAGE.LinkGraphic Remove_HTML --] alt="[-- PAGE.LinkName --]"><br>

Produces the following with two alt tags:
Code: Select all
img  src="http://www.christmasornamentshop.org/media/ss_size1/HOME-babys-first.jpg" alt="HOME-babys-first.jpg" width="160" height="160" vspace="3" hspace="3" border="0" alt="Baby's First Christmas Ornaments">

EDIT: just updated with a more accurate example.
psldesigns
 
Posts: 116
Joined: Wed Aug 16, 2006 7:06 pm
Location: Michigan

Re: stopping image alt tag from being the file name

Postby Jim » Fri Mar 30, 2012 5:52 pm

What size image did you specify for the Link Graphic Size, Original, Medium, small, extra small? The tag will pull the appropriate image size automatically so there is no reason to include the /media/ss_size1/ in your template.

NOTE: resized images are designed to only be used by the ShopSite template tags when the original size image is directly in the /media directory. If you have images in subdirectories of the media directory tags like [-- IMAGE PAGE.LinkGraphic --] and [-- PAGE.LinkGraphic Remove_HTML --] will not return the proper path including the /ss_sizex directory.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: stopping image alt tag from being the file name

Postby psldesigns » Sat Mar 31, 2012 9:06 am

This: [-- PAGE.LinkGraphic --] did use the correct ss_sizeX image, and in one site added the alt as the page NAME. On two other sites it did not add an alt at all. Do you know what would cause it to not add it? The originals are all under the media directory, were ftped there and ShopSite resizes them.

The goal would be to have total control of alt tags, title tags and captions in the image tag as those are becoming very important to SEO. The workaround above for the product template is great and will work. The PAGE template image tag is not as customizable as I can get it to EITHER have the ss_sizeX OR complete control over the tag but uses the original size. I will submit an enhancement for that feature.

Thank you so much for working through this with me!
psldesigns
 
Posts: 116
Joined: Wed Aug 16, 2006 7:06 pm
Location: Michigan

Re: stopping image alt tag from being the file name

Postby Jim » Sat Mar 31, 2012 3:21 pm

If you upload the image through ShopStie it knows about the image and can create basic attribute information when it uploades the file. If you ftp the images to the store media directory ShopSite does not know about the images. So in that case you need to select the images and click the Reset Attributes button. ShopSite will then read the images, gather information about the image such as size, name etc and then will write that information to a file. The information in that file is used to display the appropriate attributes during publish.

There is also a Reset All Attributes button that will reset the attributes for all images to their default values. You should always use either the Reset Attributes or Reset All Attributes for any images that you ftp to the site or as you discovered, no attributes will display in the html for those images.

You can manually add alt tag, or other attributes to images under the Images > Edit Images. Note that if you add additonal attributes you should not use the Reset All Attributes options or your modified options will be lost.

Creating the resized images does not automatically create the other attributes for the main image so you would need to use the Edit Images option or the Reset Attributes for the original image if you haven't already done that.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah


Return to User Forum

Who is online

Users browsing this forum: No registered users and 60 guests