News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

How do Facebook do it?

Started by Akyhne, August 28, 2014, 06:57:52 AM

Previous topic - Next topic

Akyhne

From many sites, when You post a link to an article on Facebook, they somehow make a nice box out of the link, with a header, an image and som text i a framed box.


Do they just use rss feed or what? I think it could be a great mod for SMF to do the same.

kat

They probably do something like this:



(Click that image, to go to Fartbook)

Kindred

Actually, there are several mods that already start to do something like this...   They check the page at the other side of the URL and pull the page description as the link text rather than the URL by itself...

The image, on the other hand, requires significantly more processing,since you have to parse the entire page rather than just the metatags...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

If you're already getting the page, it's not significant extra work to look for the meta og:image tag.

Antes


live627

Quote from: Kindred on August 28, 2014, 07:13:25 AM
Actually, there are several mods that already start to do something like this...
as in... one?

Kindred

https://github.com/Spuds/SMF-Descriptive-Links


However, Arantor - Facebook, if it finds no OG tag, will actually pull an image from the target page
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

Yes, it will - but with some serious caveats, and that stuff is all best done clientside rather than on the server anyway since you need to load the page, get the images - and also figure out the *size* of the images since there are limits on that.

Discourse does it (badly), so it's certainly possible. Thing is, anyone who really cares about being linked on Facebook is going to get their meta:og tag set up anyway... and anyone who doesn't is likely to end up with a wrong image anyway.

Akyhne

I thought there was something made for this - the og tag. That was really the info I was looking for. FB doesn't just create these boxes in all cases, but only when there's the right amount of OG info to do so.

Just found this page from FB, where You can see and check what OG tag FB finds from a specific page, like a news page and how it will be presented on FB.
https://developers.facebook.com/tools/debug/

Example:
https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fnyhederne.tv2.dk%2Fudland%2F2014-08-29-lige-nu-islandsk-vulkan-er-i-udbrud

Kindred

well, yes and no.

once again - facebook will pull the data from the og tags...   however, if there are no og tags, it will fall back on the meta description and the first image (within parameters)
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

Yes, but again, anyone who *wants* to be shared on Facebook will care, anyone who doesn't... eh, it's just not a huge deal.

But since other forum software does it, it's definitely doable...

Kindred

Oh... I just re-read the original post...   I was misinterpreting it.

I thought that the OP wanted links in SMF to be displayed like FB does.

I *THINK* you are going the opposite way, saying that SMF can and should support adding OG tags (to which I will actually agree)
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

No, I'm agreeing with the OP that SMF could support displaying links like Facebook does.

I'm just pointing out the flaws in the 'but the other sites have to support meta:og' deal. Sites who care about getting the free promotion factor from it will already have meta:og does. Sites who don't care won't, and finding a thumbnail is not necessarily the headache you seem to think it might be. But it's not without consequences, whether you do it browser-side or server-side, there's always concerns, to the point where meta:og is the only truly reliable thing to work with and if no meta:og, no picture in my book.

Kindred

hmmm... ok.
I don't disagree with using the meta:og stuff...     if it's there to be used, it's pretty simple to pull.
After all, the mod I alreayd linked to pulls the standard meta description.  Not too much of a jump form there to pulling og instead.

My concern was with "what to do if it isn't there"

I'd be OK with "if it's not there, ignore it"
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

You'd want the meta description, page title and meta:og tags in an ideal world.

But all of these are optional (page title isn't *strictly* optional but there's enough pages on the internet with ill-defined, inaccurate or useless titles that it might as well be) so whatever argument you have for 'should use x' will apply equally to those.

It's all about managing the fallback and expectation. Yes, something like Facebook's 'pick the thumbnails' is clever. The part most people don't realise is that this sends requests to the page (from Facebook, meaning webmasters can block it if they want) and has privacy consequences in so doing.

Akyhne

Quote from: Kindred on August 29, 2014, 10:38:34 AM
Oh... I just re-read the original post...   I was misinterpreting it.

I thought that the OP wanted links in SMF to be displayed like FB does.

I *THINK* you are going the opposite way, saying that SMF can and should support adding OG tags (to which I will actually agree)
Well, that was my intension - to have links shown in a SMF forum, like FB does. Maybe not all links, but via a tag, perhaps.

Advertisement: