0

I'm wondering how Facebook, Google, Slack or any other social network recognizes the content of a currently posted page? Anytime, when you add a link to some page (for example photo page) it will automatically create a preview with an image and title of that page...

I'm trying to create similar functionality by using NodeJS...

Any idea? Tnx.

enter image description here

Eugene Vilder
  • 492
  • 1
  • 9
  • 26

1 Answers1

1

Look at the <meta> tags with og: in them in the source of that page:

<meta content='Group of friends having fun on the seashore' property='og:title'>
<meta content='Group of friends having fun on the seashore' property='og:description'>
<meta content='https://drscdn.500px.org/photo/203795373/q%3D80_m%3D2000_k%3D1/a91b87d68203d5306a1e857494a0662e' property='og:image'>

They’re part of the Open Graph protocol, and you can look for Open Graph packages on npm. Here’s one: https://www.npmjs.com/package/open-graph

Ry-
  • 218,210
  • 55
  • 464
  • 476
  • Thank you so much! Btw.. do you know why this url doesn't work with og:? It has those metas... http://www.photosight.ru/photos/6540292/?from=top%2F50 – Eugene Vilder Jun 01 '17 at 02:57
  • @EugeneVilder: It has `name="og:title"` instead of `property="og:title"`. – Ry- Jun 01 '17 at 03:57