Adding alt and title tags to files in file manager?
Permalink 2 users found helpfulI would love to be able to add alt tags at the file manager level and not coded for every instance of that image on the site.

I did change and add the title, which previously was automatically populated with the filename. When I refreshed the product page it still did not reflect the title. I then changed the image on the product page with the image that has the title tag changed and still no title in the code. In fact, it brings up another question about the image. In the code, the image name is a random string instead of the actual image name. Isn't that counterproductive to having good file names for SEO benefits?
Barry
It is super-confusing when you need to set the Title field in File Manager to get an alt tag (not a title tag) and yet if you insert an image, you set the alt tag via a field called Image Description. The terminology is all over the place.
not to mention that updating image Titles in file manager doesn't seem to propagate through to images in Content blocks, as Barry pointed out recently. It is just very difficult to explain all this (as I have been finding to my cost this week!) to an end user.
What worked for me was to use the "Content" block to add an image and then edit that using the advanced editors "html" facility,
where you get the "style" declaration just add the title to the style,
Example - <img style="float: right;" title="Your Title Here" .......
If you add an image in the content block it gets inserted ONCE as a HTML string (it is done by the editor TinyMCE on Javascript basis). So later changes on the title cannot be reflected in your site until you remove the image and insert it again.
What Franz meant by the somehow abstract answer "not every block is going to use the same data in the presentation layer" is that the file manager is not only an image manager but for any file type. Every file can have a title but an alt tag does not really makes sense for an PDF for example.
That means if you want to have the ability to enter a title tag on images create the Attribute under Dashboard/Files/Attributes, make it of type text and name it "title". Now, If you open the property panel of a file in the file manager your newly created attribute is shown at the very bottom under "height" und "width". Enter your title text there and dont forget to safe (click the icon right to the text field).
For the content block to use your new attribute copy the content block from /concrete/blocks/content to /blocks/content. Open the file editor_init.php and look for the function: ccm_chooseAsset. In there you got two switch cases and one of the is for images. As you already might guess while looking at the code here we have the opportunity to add our title tag. Just change
tinymce.extend(args, { src : obj.filePathInline, alt : obj.alt, width : obj.width, height : obj.height, });
to
tinymce.extend(args, { src : obj.filePathInline, alt : obj.alt, width : obj.width, height : obj.height, title : obj.title // <-- your title tag });
From now on tinymc grabs your title tag but it does not change your already added content, you need to insert it again for this method to work.