Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Telegram makes the rich preview?

Tags:

telegram

Anybody knows how Telegram makes the rich preview?? It would be very useful to learn about it for a development I am making. It is a server side features, so I think the code is not available. Isn't it?

like image 327
Jose A Lopez Pastor Avatar asked Aug 29 '15 16:08

Jose A Lopez Pastor


2 Answers

It uses Open Graph protocol: http://telegram.wiki/manuals/general/link-previews

like image 149
retif Avatar answered Sep 21 '22 22:09

retif


In some posts, the preview doesn't need any work from you, for example if you have a photo URL link in your post, that is an entity of the message.

But in other cases you need to add some tag in your material, for example when you add one URL that points to an article in your website, you must tag and your HTML tag must change:

<html  prefix="og: http://ogp.me/ns#">

your head tag

<meta property="og:title" content="title text" />
<meta property="og:image" content="an image url that exist in your page" />
<meta property="og:url" content="current page url" />
<meta property="og:description" content="description text" />
like image 22
Hamid Abbasi Avatar answered Sep 22 '22 22:09

Hamid Abbasi