Original link: https://www.ixiqin.com/2022/06/17/for-your-wordpress-site-configuration-telegram-instant-view/
Telegram has a very useful reading feature built in – Instant View. Instant View enables re-layout of website content within Telegram to provide readers with a better reading experience.
As a website owner, if you want to provide corresponding support for your website, you can add your own website to the Instant View website for adaptation.
Add Instant View Adaptation for WordPress
Visit the Instant View website and log in with your own Telegram account
Instant View official website
After successful login, click My Templates on the right to enter the Templates management page.
And enter the address of any article on your website in the input box in the middle of the Templates management page, and press Enter, you will automatically enter the rule adaptation page.
Rule adaptation page
Then, enter the rules of your site in the page, here we can use the rules written by other developers . Paste the rule in the page
# Use Instant View version 2.0~version: "2.0"# Use this template only blog article pages?exists: /html/head/meta[@property="article:published_time"]# Get article text in <article> body: //article# Get title from <h1>title: $body//h1[1]subtitle: $title/next-sibling::h2author_url: //span[has-class("author")]//@href# Get article cover imagecover: //img[has-class("wp-post-image")]# Convert all iframe elements to inline element@inline: $body//iframe[starts-with(@src, "/media/")]# Remote header and footer@remove: //article/header@remove: //article/footer# Replace p to figure@replace_tag(<figure>): $body//p[.//img]# Youtube Embedded Fix@replace_tag(<figure>): $body//p[.//iframe]
After pasting and saving, the preview effect will be automatically generated on the far right page.
The effect of adding rule adaptation
When your rule adaptation effect is correct, you only need to click Mark as Checked in the upper right to mark that the page has checked the car.
Mark as check successful
After completing the first test, you only need to select 10 articles in your blog and verify the articles.
According to the rules of Telegram Instant View, you need to verify at least 10 articles before submitting your template for official review.
After submitting, you will see such a prompt, then just wait for your template to pass the test.
Submitted successfully
Preview effect
During the review, you can click “View in Telegram” in the upper right corner of the editor page to view the preview effect. Including, you can also copy the value of rhash
inside, and use this value to generate the link of the Instant View and share it with others. However, the most convenient of course is to wait until the official review is passed before using it.
Preview the effect.
Summarize
The development of Telegram Instant View is not difficult. If you master a certain HTML and XPath foundation, you can complete the development. With a few simple steps, you can make your website have a good preview effect in Telegram. This time is worth spending.
This article is reproduced from: https://www.ixiqin.com/2022/06/17/for-your-wordpress-site-configuration-telegram-instant-view/
This site is for inclusion only, and the copyright belongs to the original author.