MY website is Hidden for Privacy. I am trying to get a photo to show up when I post my link to my facebook, but I had all of my pictures in my CSS rather than in the HTML because it is a parallax site. Now I then searched what Facebook looks for with the pictures it posts and was given HTML which I then switched to haml. I did have to hide the picture simply because I can't have it displayed on the page when I already have something displayed.

My code is...

.hidden
  = link_to(image_tag("/assets/WB_small.jpg", :alt => "logo"), "/")

The HTML output is...

<div class='hidden'>
      <a href="/"><img alt="logo" src="/assets/WB_small.jpg" /></a>
    </div>

Has anyone dealt with something like this before or knows a specific way to make Facebook grab a photo, but not display it on the website?

有帮助吗?

解决方案

try this

<head>
<meta property='og:image' content='image.jpg'/>
</head>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top