The discussion revolves around creating an Instant View template for Discourse to enable instant content preview in Telegram without opening links in a browser. Users express interest in the feature, with meglio initiating the request and Falco explaining that it involves submitting parsing rules to Telegram, which is a domain-specific process. Falco clarifies that this is not a Discourse feature but a community-driven effort, and shares a basic template for rendering Discourse topics. The template focuses on extracting key elements like title, author, and image from the topic page. AndreSpecker and b4oshany inquire about implementation steps, indicating interest in using the template on their own Discourse sites.
Also, this will never be a Discourse feature. It’s a bunch of parsing rules that lives in Telegram servers and must be submitted to their team for approval. And it’s a by domain thing, so every Discourse site would need to be submitted/approved.
So what someone from the community can do is create the rule for a topic page, and share it here on Meta so people who are interested can submit their sites using the same rules.
I created a very basic view that can render Discourse topics (only the OP).
Here is the ruleset if anyone wants to implement for their own website:
~version: "2.1"
# Test so we work only on topic
?exists: /html/head/meta[@property="article:published_time"]
# Basic Data
body: /html/body/div/div/div[has-class("post")]
title: /html/body/div/h1/a
author: //b[@itemprop="author"]
author_url: //div[has-class("creator")]/span/a/@href
subtitle: //div[@id="breadcrumbs"]/div[last()]/a/span[last()]
image_url: //head/meta[@property="og:image"]/@content
# Telegram Compatibility
# img inside a is not allowed
@replace_tag(<span>): //a[has-class("lightbox")]
# img inside p is not allowed, so inline emojis
<pic>: //img[has-class("emoji")]
# and put real images into the main body
@split_parent: //p/img