3

tl;dr I'm wanting to specify NO image by default in my og:image tag.

I've been googling like a madman to figure this one out, but everything I find are questions from people who can't get their images to show up instead of preventing their images from showing up.

So, here's the deal. On my personal website in my master page is a picture of my face. Now, it's a nice picture (because, hey, it's a nice face) and I'd like to keep it, but I don't like that it's picked up by social media scrapers whenever my links are shared - that just seems a little too egotistical.

I DO like that it picks up other images, like the ones I occasionally include in my blog posts, but if there aren't any other images on a page then I want the scrapers to ignore my face.

I've experimented with commenting out the code that generates the og:image tag in my Yoast plugin, then hard coding the tag with an empty content attribute into my header.php:

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

This partially achieved the desired effect - Facebook's scraper detects that no image url is specified, but is still seems to be defaulting to whatever other image it can find.

The Open Graph protocol doesn't appear to include behavior for specifying no images, either.

Any thoughts on how I could do this?

EDIT: I just found some workarounds in this question that will probably do the trick, but if anyone has any other ideas, I would appreciate hearing them as well.

Community
  • 1
  • 1
Jerreck
  • 2,930
  • 3
  • 24
  • 42
  • I think there is no clean way to achieve "No image". Because every page required 4 properties: title, page, type, image. BTW: FB Debugger is great tool https://developers.facebook.com/tools/debug/og/object/ – Petr Duchek Dec 23 '14 at 11:10
  • Yeah, I'm afraid my only solution will be to trick the scraper, as in this answer: http://stackoverflow.com/a/8100570/2344773 – Jerreck Dec 23 '14 at 13:55
  • Interestingly, this website uses the technique in that answer: http://www.lukew.com/ , but when I try the same technique it's still using my profile pic, even after I call the scraper again (which is supposed to clear Facebook's cache). Maybe Facebook is keeping that image of mine as a fallback for awhile until it finds a new image to cache? – Jerreck Dec 23 '14 at 14:37

1 Answers1

1

Upload a blank or 100% transparent image with at least 200x200px and use it in the og:image tag.

Shadi Alnamrouti
  • 11,796
  • 4
  • 56
  • 54
  • That's a cool idea. Can you tell if the FB crawler cached the transparent image or did it see that the image was blank and remove images from your page's share data entirely? – Jerreck May 20 '15 at 14:04
  • Actually, I have not try it yet. However, the only restrictions I found on OpenGraph requirements are: (1) the image must exist. (2) the path and the file name of the image must not contain any spaces. (3) The image must not be less than 200px in width or height. Nothing is mentioned about blank or transparent images. It is worth trying. – Shadi Alnamrouti May 20 '15 at 14:30
  • The image must exist means that it does exist according to the path specified in the og:image. You are free to specify any image even if it is not used in any page including the current page you put the og:image inside. – Shadi Alnamrouti May 20 '15 at 14:45