Is there a way to add alt-tag and image-title for topics automatically?


(Pad Pors) #1

for example to set it to the topic-title itself. does it need a plugin or is it doable via simple code lines?

the reason is to become more visible to search engines.


(Jeff Atwood) #2

Do you have any proof that both are needed? Please cite proof. You can specify title, certainly:

http://commonmark.org/help/tutorial/06-images.html


(Pad Pors) #3

well, i don’t have strong proofs, but these may help (though they may be old for this forum):

and this link which says:

" alt text and SEO: Google, in their article about images, has a heading “Create great alt text”. This is not a coincidence, Google places a relatively high value on alt texts to determine what is on the image but also to determine the topic of surrounding text."

and of course, nowhere says both are needed. but for slow connections alt-tag may be useful.

thanks for the link and your response, btw :smiley:


(Jeff Atwood) #4

Well let’s see what we get:

Google “Google”

![Google](//discourse-meta.s3-us-west-1.amazonaws.com/original/3X/9/f/9f2ba2b881f05e0e028383751e0a31b581cff886.png) "Google"

Looks like both are already populated, so there is nothing to do here.

<div class="cooked"><p>Well let's see what we get:</p>
<p><img src='//discourse-meta.s3-us-west-1.amazonaws.com/original/3X/9/f/9f2ba2b881f05e0e028383751e0a31b581cff886.png' 
    alt="Google" title="&quot;Google&quot;" width="544" height="184"></p>

Looks like maybe a bug around the title though there.


(Pad Pors) #5

I’m little bit confused here, haven’t you added the alt-tag and title yourself via the img tag?

I mean did you just upload the image and it added some name to the image? or did you use the alt="" in the img tag?

the thing is that our users are non-technical, and it’d be easier if the alt-tag attach to the image automatically. and i’m looking for a simple way to add the topic-title to images automatically.

just to test, here I attach an image:

and here I attach an image and add the alt-tag to it:
learning


(Mittineague) #6

True, the validator does say

Error: An img element must have an alt attribute, except under certain conditions. For details, consult guidance on providing text alternatives for images.

But I’m more concerned about the “p” errors.

https://validator.w3.org/nu/?doc=https%3A%2F%2Fmeta.discourse.org%2Ft%2Fpost-your-discourse-t-shirt-pics%2F41289

For the attributes to be of any value is not such an easy thing.

The only appropriate approaches that I can think of are for members to add the attr vals themselves either directly into the editor or by a form input.

To add the same values to all images could have a negative search engine effect as it could be seen as “stuffing”.


(Pad Pors) #7

not the same value to all images, but for example the topic-title for the main topic, or the name of the saved image, e.g. if i have an image called learning.png, then the alt-tag can be learning .


(Pad Pors) #8

if i’m not wrong, large images have the name of the image by default (without naming it in the code). how is it so?

is it possible to set how large an image should be so that it has the image name attached to it when posting?