Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
I need to add alt tags for images to make our site ADA compliant, what's the best way to do this?
I've also tried to put a k show folder title tag in the alt tag on the template page, it doesn't appear unfortunately.
Hi,

Suppose you have defined an image region as follows -
Code: Select all
<cms:editable name='my_image' label='Image' type='image' show_preview='1' preview_width='150' order='1' />
and it is being used as follows in your HTML on the front-end -
Code: Select all
<img src="<cms:show my_image />" />


To add alt tag to it, define one extra editable region (type 'text') next to it to hold the alt text as follows
Code: Select all
<cms:editable name='my_image' label='Image' type='image' show_preview='1' preview_width='150' order='1' />
<cms:editable name='my_image_alt' label='Image Alt Text' type='text' order='2' />
Now you can modify the HTML on the front-end to include the text inputted in the new region -
Code: Select all
<img src="<cms:show my_image />" alt="<cms:show my_image_alt />" />

Hope this helps.
Thanks as usual KK!

I had tried this with a <cms:show k_folder_title /> in the alt tag, but the alt shows up as blank when viewing the page source after, do you know why that would be?

<center><a href="<cms:show main_image /> " data-rel="lightcase:gal1" ><img src="<cms:show main_image />" width='85%' height='85%' alt="<cms:show k_folder_title />"/></center>
You are welcome :)

The reason why the alt tag shows up blank could be that the 'k_folder_title' variable might not be available in the view you are using it (it becomes available in 'folder-view' only; for 'page-view', the variable is actually 'k_page_foldername').

There is no need to memorize, however, which variables are available at what locations - an easy way to actually see all variables is by placing a <cms:dump_all /> tag somewhere close to the location you wish to use the variable at. You should see a list of all variables (and their values) which should help you in choosing the correct one. Try it.

Hope this helps.
KK wrote: You are welcome :)

The reason why the alt tag shows up blank could be that the 'k_folder_title' variable might not be available in the view you are using it (it becomes available in 'folder-view' only; for 'page-view', the variable is actually 'k_page_foldername').

There is no need to memorize, however, which variables are available at what locations - an easy way to actually see all variables is by placing a <cms:dump_all /> tag somewhere close to the location you wish to use the variable at. You should see a list of all variables (and their values) which should help you in choosing the correct one. Try it.

Hope this helps.


This did the trick, thanks so much and have a great weekend!
6 posts Page 1 of 1
cron