facebook graph api - Octobercms - og:image -
i've setup blog using octobercms , plugin rainlab blog. problem want use featured image facebook sharing image.
how can done? when go facebook debugger, can see logo , featured image, once share it, display image logo.
many thanks
in page/layout using blog post, need add opengraph tags if haven't already.
<meta property="og:url" content="http://www.yourwebsite.com" /> <meta property="og:type" content="website" /> <meta property="og:image" content="{{ this.getshareimageurl }}" /> <meta property="og:title" content="lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod" /> <meta property="og:description" content="lorem ipsum dolor sit amet, consectetur adipisicing elit. obcaecati modi illo explicabo quidem ipsa, voluptatum quibusdam, nemo veritatis enim eveniet doloribus et eius voluptate nam cum veniam, fugit. dolorum, adipisci." />
facebook needs these tags pull right data. might find this useful read more these tags.
so should need url correct featured_image since have more 1 featured_image. can choose write logic want (hence used method call in code above), once have instance of featured_image want, can use getpath() method on instance url (since instance of file class, can use methods on it).
you can read further documentation here - http://octobercms.com/docs/database/model#file-attachments
that's it, go fb debugger , press debug. if doesn't work, try using other button says 'fetch new scrape information' (only appears after have pressed debug button once already) , should good.
i went thru these steps new website , had let facebook re-scrape work. let know if works you.
Comments
Post a Comment