Forum
Adding Facebook 'share' images
Does anyone know how to pull out an image from a Perch Event post and add that to some header code for the Facebook sharing code (below), and if one doesn't exist then fallback to a default image?
<meta property="og:image" content="/path-to-image/image.jpg" />
<meta property="og:image:type" content="image/jpeg" />
<meta property="og:image:width" content="1201" />
<meta property="og:image:height" content="450" />
Richard
You should be able to use a
perch:if
to test for the imageYep, that would be nice and simple Drew, but because it's an Event post page I'm not sure how I'd do that.
Here's my Event page:
The actual content is in 'template'=>'events/event.html'
Copy the fields into a new template for your Facebook tags, and then display the content using that template:
Awesome, thanks Drew!
For anyone else's future reference, my facebook.html looks like this: