3

I want to follow good SEO practices by adding alt tags to all my images.

For Facebook sharing, I have this code:

<meta property="og:image" content="...">

Can I add an alt="Facebook image" to that?

migrated from stackoverflow.com Jun 29 '14 at 21:31

This question came from our site for professional and enthusiast programmers.

  • 1
    No. og:image is just a link to an image file, it doesn't need an alt tag. Open graph already has tags for title and site_name. <meta property="og:title" content="Site Title"> for example. – Nick R Jun 27 '14 at 15:56
6

No, you do not need an alt attribute on that meta tag. In fact, it is not even allowed as others have already said.

However, (today) Open Graph specifies and even suggests to provide the image alt text via an og:image:alt property. See http://ogp.me/#structured.

Note that the og:image meta tag is not an image tag, but rather a hint on which image should be used when displaying that page somewhere else. Thus, the specified alt text will probably improve the image usage for that other site that embeds your page, e.g. Facebook.

3

No, a meta element cannot have an alt attribute in any HTML specification. Technically, you could have the attribute title="Facebook image", since the title attribute is allowed for all elements according to HTML5 LC (though not HTML 4.01), but it is very unlikely that any browser or search engine cares about it for meta; so it would matter as comment-like documentation only.

2

og specification does not have alt attribute. You can check valid attributes at the open graph protocol website.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.