Skip to content

Instantly share code, notes, and snippets.

@mrhalix
Created May 28, 2019 11:08
Show Gist options
  • Save mrhalix/9073e7c272e77cf65d606562b18f73cf to your computer and use it in GitHub Desktop.
Save mrhalix/9073e7c272e77cf65d606562b18f73cf to your computer and use it in GitHub Desktop.
Telegram instantview template used for https://aminaleahmad.ir, adding some changes might get it to work for you too!
# Use Instant View version 2.0
~version: "2.0"
@datetime(-2): /html/head/meta[11]
published_date: $@
# Get article text in <article>
body: //article
# Added by halix
channel: "@mrhalix"
site_name: "تجربیات برنامه نویسی من!"
# Get title from <h1>
# title: $body//h1[1]
title: //h2[has-class("page-title")]
subtitle: $title/next-sibling::h2
author_url: //span[has-class("author")]//@href
# Get article cover image
cover: //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]
@set_attr(dir, "rtl"): $body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment