How to prepare HTTP response body for unfurling of URL on LinkedIn? - http

"Unfurling is the technical term for what happens when you share a link on Twitter, Facebook, LinkedIn or Slack." (From the book: Designing Bots: Creating Conversational Experiences
By Amir Shevat)
What spec does the HTTP response body have to conform to in order to enable unfurling the link on the LinkedIn ?

Unfurling works by the app being able to read the meta tags in the HTML head of your document at the specified URL.
There are a few specs that most of the services you listed will use and/or fallback on, including og (opengraph) and twitter.
Your HTML head needs to contains something like this (for opengraph)
<meta property="og:url" content="your website url" />
<meta property="og:title" content="the title that shows up in the unfurled preview" />
<meta property="og:description" content="the description in the preview" />
<meta property="og:image" content="the url of the image you want to show in the preview" />
Note that if you are building an SPA or something that dynamically loads content based on route parameters, you'll need to do server side rendering or something that can serve the HTML statically, because the unfurl-er will not run the javascript that would add to the DOM.
There is also something called oEmbed that is a standard for sharing meta data with other services. This would be a server that responds with JSON about the links you post. Slack primarily relies on oEmbed but will fall back on og or twitter tags if it isn't available.

Related

Whatsapp social sharing with Meteor

I already have the social-share button for whatsapp on my webpage, but when you choose a contact to send, it only writes "title_content url" on the writing box. It seams that whatsapp doesn't see the meta tags of the webpage to create a nice box with the image, title and description.
I am using the following open-Graph meta tags and it is working fine with facebook social sharing:
<meta property="og:type" content="website" />
<meta property="og:title" content="{{event.name}}" />
<meta property="og:description" content="{{eventDescription event.information}}" />
<meta property="og:url" content="{{eventUrl url}}" />
<meta property="og:image" content="{{eventImage event}}" />
<meta property="og:image:width" content="500" />
<meta property="og:image:height" content="500" />
<meta property="fb:app_id" content="#####" />
I do not have a icon for my event, so I can't set up the tag:
<link rel="shortcut icon" href="###.ico" type="image/x-icon">
I tried to set it with a .png image but it didn't work. So, what else can I do to whatsapp see my website and render that box with the image, title and description?
I just found out what was happening. When you try to feed information to facebook or twitter crawlers you need a special way to do it. So you have to create a crawler route with filter and dynamic content (as you can see on this tutorial that i created: Tutorial ).
With whatsapp you don't need to worry about server side rendering. When I created my open-graph meta tags direct on the <head>.
Eddited:
Because I need meta tags that work dynamically, I had to stop using direct on the <head>. But the docHead() or any of the packages were not working for me. So I realised that whatsapp can work from server side and use the same og: tags that I already have for facebook.
I just needed to find its user-agent that is WhatsApp/2.17.107 A and add the permition like I did for the other ones on the server side route.

Wordpress featured image with ACF

So,
I use Advanced Custom Fields on Wordpress to set an featured image that i host on flickr, this way i can query it perfectly in the template i am building.
But this image isn't in the content(text) of the post, so for example Facebook or Twitter or any social media to share posts to don't see this image.
So in posts wherefore i only have one image. Which i show on top of the post as background for the title won't be shown inside the content and therefore social media don't recognize it.
Bullet points:
Wordpress Advanced Custom Fields plugin to add a field to a post where in i paste the url of the picture on flickr.
I can perfectly query the URL and implement it in the template i am building.
But this means that this picture isn't in the post content(text). Therefore social media don't seem to see this picture and don't show a picture if users want to share a article from my website.
I really don't know how to solve this and i hope that somebody has a solution.
English isn't my first language so excuse me in case of any spelling or grammar errors.
I don't really get why you want to host your featured image outside WP or, more specifically, on Flickr... but if you can get its URL via ACF (I guess you're using an URL field) and the issue is Facebook or Twitter doesn't retrieve your image when you share your page, maybe you should implement Open Graph and Twitter Card meta tags.
That's, in your header.php inside <head>:
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="#youraccount" />
<meta name="twitter:creator" content="#youraccount" />
<meta property="og:title" content="The title" />
<meta property="og:type" content="website" />
<meta property="og:url" content="http://www.example.com/your-page" />
<meta property="og:image" content="http://www.example.com/your-flickr-image-url" />
<meta property="og:description" content="Content description..." />

Difficulty with OpenGraph for Facebook embedded video

I am having some difficulty implementing a solution that I found via my research here (the actual accepted answer is not helpful and has been downvoted to Bolivian).
Problem: Facebook doesn't seem to recognize the OpenGraph meta tags that I have added to my Header.
What I know (or think I know): It is my understanding that by adding some appropriate opengraph meta tags, the content, such as YouTube video, should appear in the body of the "post" on Facebook.
What I have tried so far: Referring to the solution linked above, I have tried to implement this method.
In my examples, I'm embedding this video
https://www.youtube.com/v/BQBjVr1iHH4 in the following page
https://www.keithandthegirl.com/vip/bonus/episode/9/40/this-is-40 I
would like Facebook to show the YouTube video whenever anyone shares
my page on Facebook.
Option 1: setting the og:video to https://www.youtube.com/v/YOUTUBECODE
The meta tag will look like
<meta property='og:video' content='https://www.youtube.com/v/BQBjVr1iHH4' />
Further, I have attempted to disable plugins which may conflict with this -- any plugins which appear to add OG meta tags.
On the code side: I have hard-coded the following meta tags in the Header (this will eventually become a PHP function or something, but not until/unless I can make it work on a single post):
<meta property='og:image' content='http://agnarchy.com/wp-content/uploads/2014/11/2014-11-01-22.02.37.jpg' />
<meta property='og:video' content='https://www.youtube.com/v/dt6pPdz5eqg' />
<meta property="og:video:height" content="854" />
<meta property="og:video:width" content="510" />
<meta property="og:type" content="video">
Observed behavior:
All I see is the post's featured image. When I schedule or submit this link to my facebook page, Facebook does not recognize the OpenGraph tags and does not render the embedded video as part of the content of this Facebook post:
Desired behavior:
This is at odds with the suggested method, which if I use the URL provided in that answer, I can see the embedded video player:

how to change my wordpress homepage title, description and image on facebook

I build a new wordpress site and installed the Yoast SEO plugin.
My homepage defined as some of my pages.
When i post the link on facebook i can't see any description/title/image that i want
checked on - https://developers.facebook.com/tools/debug/og/object/
i got:
og:type article
(i think that In order to work should appear : website)
maybe someone knows Where I'm wrong?
Thank you!
Facebook uses OpenGraph, a protocol for which if no default values are defined (and you have no standard HTML <meta> values defined,) you can set certain properties so that your site will appear as you want it when you share it socially.
It should be noted that Opengraph will, by default, attempt to interpret these properties by their corresponding <meta> elements (stuff like <meta name="description" content="describe my site">).
If you don't have these, I suggest you add them, but the OpenGraph properties can be defined explicitly, too. The process for adding properties like this involve the use of the <meta> tag, typically in your header.php.
There are a lot of properties you can define
I think most pertinent to your situation would be:
<meta property="og:image" content="path/to/image">
<meta property="og:title" content="My cool website">
<meta property="og:description" content="Description of site">
These work for sites that use OpenGraph, but it's no substitute for having proper <meta> tags in the <head> of your document.
here's a bit of reading you can do on defining site meta
Hope this helps!

Open Graph Type Tag Facebook Application

We have a web site www.mywebsite.com that sells widgets which implements Open Graph tags as follows:
<meta property="og:title" content="This is the title of the widget model" />
<meta property="og:type" content="product" />
<meta property="og:url" content="http://mywebsite/widget/67734" />
<meta property="og:image" content="http://mywebsite/images/123456.JPG" />
<meta property="og:site_name" content="My Website" />
We have a developer who has been asked to create a Facebook application that also sells widgets. He has asked me to change the og:type value on our website pages from "product" to "widget" so that Facebook application displays a description to the user that includes "widget" instead of "product". My understanding is that the Open Graph Protocol has a defined set of types that can be used:
http://ogp.me/#types
I'm concerned that by using a type not defined in the protocol I will degrade my ranking with Facebook, Google, or any other Open Graph subscriber. Is this correct? Shouldn't the Facebook application have the custom type value and NOT our website?
Step 3 of Facebooks Open Graph Tutorial ( https://developers.facebook.com/docs/opengraph/tutorial/ ) provides instructions for creating a custom type, including your own namespace. However, this documentation is for creating a facebook app and is not written to descriibe how to implement OG tags on your websites pages. After further reading I found facebook specify that OG types must be only those specified in the OG protocol. See Step 2 of http://developers.facebook.com/docs/reference/plugins/like/ which discusses implementing a like button:
"You must select a type from the list of Open Graph types."
In the end, the answer is to only use OG defined types for your web sites pages.

Resources