This document describes Telegram's Instant View format in stupefying detail. If this is your first time hearing about Instant View, please check out our Introduction and Sample Templates before you dive in.
If you're comfortable with the idea of Instant View templates, let's look at what makes them tick. To begin with, this is our in-house artist's idea of how Instant View pages are generated:
It turns out, he is not entirely wrong. This is how Instant View pages are really generated:
text/html
).This document will explore the Instant View Format, the Types of Rules your template can utilize, as well as some useful XPath constructs, conditions, and functions that may help you build better templates.
This manual was intended to be used as a reference, so you don't have to read the entire thing to get started. Our sample templates make for a much better entry point. You can check back here whenever something is not clear.
silent
parameter which ignores errors while fetching a pageVersion 2.1
srcset
attribute in Image and Icon types. The IV engine will automatically take the highest image resolution available (but not higher than 2560px).Also in this update:
Instant View 2.0 expands the platform with support for right-to-left languages, new page blocks, useful functions and much more. We recommend using the latest version in your templates. To do this, add the following rule at the beginning of the template:
Below is a list of changes in version 2.0:
New properties:
New types:
New types of rules:
New functions:
Other features and improvements:
+
(see more)<cite>
tag)href
attribute for the Image type)@simplify
function for better processing RichText (e.g. saves line breaks formed by block elements)An Instant View page is an object with the following properties:
Parameter | Type | Description |
---|---|---|
title Required | RichText | Page title |
subtitle | RichText | Page subtitle |
kicker | RichText | Kicker |
author | String | Author name |
author_url | Url | Author link |
published_date | Unixtime | Date published |
description | String | A short description (used in link preview) |
image_url | Url | Link preview photo (used in link preview) |
document_url | Url | Link preview document (used in link preview) |
site_name | String | Name of website (used in link preview) |
channel | String | The username of the article author's (or the originating website's) channel on Telegram in the format @username |
cover | Media (Image/Video/Embed/Map) | Page cover |
body Required | Article | Page content |
The platform supports right-to-left languages. If <html>
tag or tag referenced by body property has the attribute dir="rtl"
, the page will be marked as RTL. In case this attribute is not set, you can set it manually to display the page in Instant View as RTL using the following rule:
The IV page object can hold the following types:
Type | Allowed children | Description | HTML counterpart |
---|---|---|---|
Article | Header Subheader Paragraph Preformatted Divider Anchor List Blockquote Pullquote Media Image Video Audio Embed Slideshow Table Details Footer RelatedArticles | Page content | <article> |
Header | RichText | Major heading | We use the top-level of the <h1> – <h4> headings found on the source page |
Subheader | RichText | Minor heading | We use the remaining headings <h1> – <h4> as well as <h5> – <h6> headings |
Paragraph | RichText | A paragraph | <p> |
Preformatted | RichText | Preformatted text | <pre> with the optional attribute data-language * |
Anchor | – | Anchor | <anchor> with the attribute name that contains the anchor name |
Divider | – | A separator | <hr> |
List | ListItem | A list | <ul> for a bullet list, <ol> for a numbered list |
ListItem | version 1.0: RichText version 2.0: Header Subheader Paragraph Preformatted Divider Anchor List Blockquote Pullquote Media Image Video Audio Embed Slideshow Table Details | A list item | <li> |
Blockquote | RichText QuoteCaption | A block quote | <blockquote> |
Pullquote | RichText QuoteCaption | A pull quote | <aside> |
QuoteCaption | RichText | Caption of a quote | <cite> |
Media | Image Video Audio Embed Map MediaCaption | Media content | <figure> |
Image | – | An image | <img> with the attribute src and the optional attribute href to make the image clickable. Allowed formats: GIF, JPG, PNG (GIF would be converted into Video type by IV)As of version 2.1, supports the attribute srcset (srcset has higher priority than src , the same as in a browser; IV gets the highest available resolution under 2560px). |
Video | – | A video | <video> with the attribute src , or containing the tag <source type="video/mp4"> with the attribute src |
Audio | – | An audio | <audio> with the attribute src , or containing the tag <source> with the attribute src and the attribute type (possible types: audio/ogg , audio/mpeg , audio/mp4 ) |
Embed | – | An embedded element | <iframe> with the attribute src . List of supported embeds |
Map | – | A map | <img> or <iframe> with the attribute src referring to Google or Yandex maps |
Slideshow | Media (Image/Video) Image Video MediaCaption | A slideshow | <slideshow> |
MediaCaption | RichText | Media caption | <figcaption> As of IV 2.0, can contain an additional tag <cite> with attribution (author, creator or source of the media) |
Table | TableCaption TableRow | A table | <table> |
TableCaption | RichText | A table caption | <caption> |
TableRow | TableCell | A table row | <tr> with the optional attributes align , valign , can be wrapped with <thead> or <tbody> or <tfoot> with the optional attributes align , valign |
TableCell | RichText | A table cell | <td> for a standard cell, <th> for a header cell, with the optional attributes align , valign , colspan , rowspan |
Details (version 2.0+) | DetailsHeader Header Subheader Paragraph Preformatted Divider Anchor List Blockquote Pullquote Media Image Video Audio Embed Slideshow Table Details | A collapsible block | <details> with the optional attribute open to be opened by default |
DetailsHeader (version 2.0+) | RichText | A visible heading for the collapsible block | <summary> |
RelatedArticles | Header Link | Related articles | <related> containing one of <h1> – <h6> tag as header of the block and <a> tags with the attribute href containing a URL of related article. Note: Only articles that have an IV will appear in this block on the IV page. |
Footer | RichText | The footer | <footer> |
RichText | Bold Italic Underline Strike Fixed Marked Subscript Superscript Icon Link EmailLink PhoneLink LineBreak Anchor Reference String | Formatted text | Text elements and supported tags |
Bold | RichText | Bold text | <b> or <strong> |
Italic | RichText | Italic text | <i> or <em> |
Underline | RichText | Underlined text | <u> or <ins> |
Strike | RichText | Strikethrough text | <s> or <del> or <strike> |
Fixed | RichText | Monospace text | <code> or <kbd> or <samp> or <tt> |
Marked | RichText | Marked text | <mark> |
Subscript | RichText | Subscript text | <sub> |
Superscript | RichText | Superscript text | <sup> |
Icon | – | A small image inside the text | <pic> with the attribute src , width , height . Can contain the attribute optional if the image is not important and may be ignored. Allowed formats: JPG, PNG.As of version 2.1, supports the attribute srcset (srcset has higher priority than src , the same as in a browser). |
Link | RichText | A link | <a> with the attribute href containing a URL |
EmailLink | RichText | A link to an email address | <a> with the attribute href containing a mailto: link |
PhoneLink | RichText | A link to a phone number | <a> with the attribute href containing a tel: link |
Reference | RichText | A reference | <reference> with the attribute name that contains the reference name |
LineBreak | – | Line break | <br> |
Telegram apps currently do not support code highlighting, but they will in the future. For this reason, it is advisable to include the code language attribute (data-language
) for large <pre>
blocks if it is supplied in the source.
Instant View rules are instructions that tell our IV bot where to find the meta-elements on the source page and how it should modify the content of the page when an Instant View page is created.
Each new line in a template describes a new rule. When the bot renders a page into the Instant View format, it applies rules from the relevant template one after another and ignores any empty lines. You can leave comments by starting a line with #
, all following text on that line will be ignored unless enclosed in quote marks. You can use the \
symbol to carry a rule over to the next string, like this:
Most rules are based on XPath 1.0 expressions used to locate the required nodes on the source page.
A block of rules may have a name. In this case, it can be reused in other rules.
We support the following types of rules:
Conditions offer unlimited flexibility for your templates. Rules of this type begin with the symbols ?
or !
and use the following format:
Groups of conditions that immediately follow one another are interpreted as a block. ?
-rules follow the OR logic when joined, while !
-rules follow the AND logic. This means that for the bot to apply each block, all !
-conditions in the block and at least one of the ?
-conditions within it must be met. This also means that each block must have at least one ?
-condition.
Blocks of conditions split your rule set into groups. Groups of rules that do not have any conditions are always applied. All other groups are only applied if their conditions are met.
Check out the Supported Conditions to see what works out of the box »
Properties are the building blocks for your IV page. Check the Instant View Format for a list of properties that can be used when creating IV pages (you can also define custom properties, but they will not be used anywhere on the resulting IV page). Use this format to fill properties:
Properties store the first node that matches the XPath expression xpath_query
. By default, if a property already has a value, it will not be overwritten. You can change this behavior by adding !
to the property name – in this case a new non-empty value can be assigned. If you add !!
to the property name, even an empty new value can be assigned to the property.
You can also assign a string
to the property instead of the xpath_query
. In this case, the property will contain a text element with the specified text. It is also possible to assign null
to discard the property's value (will only work with !!
).
Reminder: The title and body properties are required for an IV page to be created.
Variables are useful for storing and manipulating nodes before assigning them to properties for the final IV page. Variable names begin with the $
symbol. Use this format to initialize them:
Variables store a list of nodes that match the Xpath expression xpath_query
. If a variable is assigned for the second time, its previous value is overwritten. You can change this behavior by adding ?
to the variable name. You can also append a list of nodes to the previous one by adding +
to the variable name.
You can also assign a string
to the variable instead of the xpath_query
. In this case, the variable will contain a list with one text element that has the specified text. It is also possible to assign null
to discard the variable's value.
Options affect how the page is processed by the bot. Options begin with the ~
symbol. Use this format to set them:
Options can be set with values in JSON format.
Check out Supported Options to see what else works out of the box.
Functions are extremely flexible, but you'll probably mostly use them to strip unnecessary nodes from the page and to replace certain elements with others. Function names begin with the @
symbol, you can use the following format:
The main argument of a function is a list of nodes that match the Xpath expression xpath_query
. You can also use a string
as the main argument instead of an xpath_query
. In this case, the main argument passed to the function will be a list with one text element that has the specified text.
Note: You may find the @debug function particularly useful when creating XPath expressions.
Check out Supported Functions to see what else works out of the box.
Block functions manipulate blocks of rules. Block function names also begin with the @
symbol, you can use the following format:
A block function can contain another block function so they can be nested. Block function can not contain conditions.
Please note that block functions that execute a block of rules several times (map, repeat, while, while_not) have a limit on the total number of iterations for the entire template.
Check out Supported Block Functions to see what else works out of the box.
Note: This is a service rule, it will not work in your templates. It was included in this reference to give you a better understanding of how the system works. You can see an example of this rule at work in the Processing Pages section.
Rules of this type begin with the +
symbol and use the following format:
This rule inserts a block of rules with the specified name. In most cases, the name corresponds to the domain to which the rules apply.
$$
and $@
The special variables work within a group of rules.
$$
variable always contains the result of the most recent XPath query.$@
variable holds the return of the most recently run function.These variables come in handy when you're creating chains of rules. If a rule is missing xpath_query, the statement is considered to be equal to $$
.
For your convenience, you can use the following constructs in your XPath expressions.
Regular XPath queries search for nodes in the context of the entire document. To specify the context for a particular expression, you can use variables in the format $context
. If a matching variable exists, the query will be made relative to each variable node. If it doesn't and a matching property exists, the query will be made relative to the property node. If no matching variables or properties exist, the query return an empty list.
The result of an XPath query is always a list of matching nodes. If you'd like to narrow the list down to a single node, you can use the following syntax: (xpath_query)[n]
, where n
is the number of the desired node. Numbering starts at 1, you can get the last node by using the last()
function. This syntax can only be applied to the entire expression.
You will often need to locate nodes that have a certain class. To do this, you can use the has-class("class")
function that serves as an alias for the expression contains(concat(" ", normalize-space(@class), " "), " class ")
.
XPath has a starts-with
function that checks whether the first string starts with the second string but does not have ends-with
. In IV you can use the ends-with("haystack","needle")
function that serves as an alias for the expression (substring("haystack", string-length("haystack") - string-length("needle") + 1) = "needle")
.
An axis that selects the previous sibling of the current node. Serves as an alias for the expression preceding-sibling::*[1]/self
.
An axis that selects the next sibling of the current node. Serves as an alias for the expression following-sibling::*[1]/self
Below are conditions supported in Instant View rules.
Checks whether the domain of the current page matches a regular expression. The check is case-insensitive, so the actual expression used will look like this: /^regexp$/i
.
Checks whether the domain of the current page does not match a regular expression. The check is case-insensitive, so the actual expression used will look like this: /^regexp$/i
.
Checks whether the path to the current page matches a regular expression. The check is case-insensitive, so the actual expression used will look like this: /^regexp$/i
.
Checks whether the path to the current page does not match a regular expression. The check is case-insensitive, so the actual expression used will look like this: /^regexp$/i
.
Checks whether target nodes exist on the current page.
Checks whether target nodes do not exist on the current page.
A condition that is always true.
A condition that is always false.
Below are options supported in Instant View rules.
Sets the version of IV used in the template. The behavior of some IV functions may change according to the version provided (see the manual of corresponding function).
The value must be one of "1.0"
, "2.0"
or "2.1"
. We recommend using the latest version, 2.1.
Please note that
version
should be set at the beginning of the template before any other rules.
Sets the origin (or the list of origins) from which content can be loaded using the @load and @inline functions.
The value should be String or Array of String.
The general format for a function is the following:
Each function accepts the list of nodes returned by the XPath statement as the main parameter. You may omit xpath_query
, in which case $$
, the result of the previous XPath query, will be passed into the function. The function then processes each element in the list and returns a list of transformed nodes which are stored in the $@
variable.
Below is a list of functions that are supported in Instant View rules.
Logs the elements passed into the function, these elements will be displayed in the status line at the bottom of the screen in the Instant View Editor. Returns the elements passed. Consider combining with $$
and $@
.
Look for debug output at the bottom of your Editor:
Removes target nodes from the page, returns an empty list.
Inserts content, specified by the parameter, to the end of each target node.
<tag>
node will be created. The following two parameters then specify the name and value of an attribute for that node. If value
has the format @attr
, the value of the attribute attr
in the target node will be used as the value. value
can be an XPath expression that begins with .
, in this case the query will be executed relative to the relevant node, and the text value of the returned elements will be used as the attribute's value. Otherwise, value
will be used as the attribute's value.@attr
, a new text element with value of the attribute attr
of the targeted node will be created.Returns a list of the newly created nodes.
Inserts content, specified by the parameter, to the beginning of each target node.
<tag>
node will be created. The following two parameters then specify the name and value of an attribute for that node. If value
has the format @attr
, the value of the attribute attr
in the target node will be used as the value. value
can be an XPath expression that begins with .
, in this case the query will be executed relative to the relevant node, and the text value of the returned elements will be used as the attribute's value. Otherwise, value
will be used as the attribute's value.@attr
, a new text element with value of the attribute attr
of the targeted node will be created.Returns a list of the newly created nodes.
Inserts content, specified by the parameter, after each target node.
<tag>
node will be created. The following two parameters then specify the name and value of an attribute for that node. If value
has the format @attr
, the value of the attribute attr
in the target node will be used as the value. value
can be an XPath expression that begins with .
, in this case the query will be executed relative to the relevant node, and the text value of the returned elements will be used as the attribute's value. Otherwise, value
will be used as the attribute's value.@attr
, a new text element with value of the attribute attr
of the targeted node will be created.Returns a list of the newly created nodes.
Inserts content, specified by the parameter, before each target node.
<tag>
node will be created. The following two parameters then specify the name and value of an attribute for that node. If value
has the format @attr
, the value of the attribute attr
in the target node will be used as the value. value
can be an XPath expression that begins with .
, in this case the query will be executed relative to the relevant node, and the text value of the returned elements will be used as the attribute's value. Otherwise, value
will be used as the attribute's value.@attr
, a new text element with value of the attribute attr
of the targeted node will be created.Returns a list of the newly created nodes.
Inserts each target node to the end of the base node.
The first parameter specifies the base node. You can pass an XPath expression that begins with .
, in this case the query will be executed relative to the relevant node. The first relevant node will be used as the base node. You can also pass a variable name. If such a variable exists, the first relevant node will be used as the base node. If the variable doesn't exist or is empty, the property with a matching name will be used as the base node.
Returns a list of target nodes.
Inserts each target node to the beginning of the base node.
The first parameter specifies the base node. You can pass an XPath expression that begins with .
, in this case the query will be executed relative to the relevant node. The first relevant node will be used as the base node. You can also pass a variable name. If such a variable exists, the first relevant node will be used as the base node. If the variable doesn't exist or is empty, the property with a matching name will be used as the base node.
Returns a list of target nodes.
Inserts each target node after the base node.
The first parameter specifies the base node. You can pass an XPath expression that begins with .
, in this case the query will be executed relative to the relevant node. The first relevant node will be used as the base node. You can also pass a variable name. If such a variable exists, the first relevant node will be used as the base node. If the variable doesn't exist or is empty, the property with a matching name will be used as the base node.
Returns a list of target nodes.
Inserts each target node before the base node.
The first parameter specifies the base node. You can pass an XPath expression that begins with .
, in this case the query will be executed relative to the relevant node. The first relevant node will be used as the base node. You can also pass a variable name. If such a variable exists, the first relevant node will be used as the base node. If the variable doesn't exist or is empty, the property with a matching name will be used as the base node.
Returns a list of target nodes.
Changes the name of the tag. The new name for the tag should be passed as the first parameter. Returns target nodes.
Wrap each target node in the <tag>
tag. Returns a list of the new <tag>
elements.
Wrap an HTML structure around the content of each target node in the <tag>
tag. Returns a list of new <tag>
elements.
Creates a copy of each target node. Returns a list of the newly created nodes.
Separates the target node from the rest in the parent tag. Creates a copy of the parent tag and wraps the target node into this new instance. Returns a list of parent tags that contain target nodes.
Splits the parent tag by the target node. Places preceding siblings wrapped into parent element before the target node. Places following siblings wrapped into parent element placed after target node.
Returns a list of target nodes.
Specifies that the text inside the target node is already formatted. Returns a list of matching nodes.
Sets an attribute in each matching node. The name of the attribute is passed in the first parameter. The value of the attribute is the rest of the parameters concatenated.
If value
has the format @attr
, the value of the attribute attr
of the target node will be used as the value. value
can be an XPath expression that begins with .
, in this case the query will be executed relative to the relevant node, and the text value of the returned elements will be used as the attribute's value. Otherwise, value
will be used as the attribute's value.
Returns a list of attribute nodes.
Sets multiple attributes for each of the target nodes. Each two parameters specify the name and value for the new attributes.
If value
has the format @attr
, the value of the attribute attr
of the target node will be used as the value. value
can be an XPath expression that begins with .
, in this case the query will be executed relative to the relevant node, and the text value of the returned elements will be used as the attribute's value. Otherwise, value
will be used as the attribute's value.
Returns a list of the matching nodes.
Performs a search based on a regular expression. Replaces the content of the target node with the search result. The second parameter specifies the number of the captured parenthesized subpattern. If this is not specified, the text that matched the full pattern will be used. You can specify modifiers for the regular expression using the optional parameter (ims modifiers are supported).
Returns a list of target nodes. As of IV 2.1, returns a list of target nodes the content of which matched the regular expression.
Performs a search and replace operation using the regular expression. You can specify modifiers for the regular expression using the optional parameter (ims modifiers are supported).
Returns a list of target nodes. As of IV 2.1, returns a list of target nodes the content of which was replaced by the regular expression.
Encodes the content of the target node as per RFC 3986. Returns target nodes.
Decodes the content of the target node as per RFC 3986. Returns target nodes.
Convert special characters in the target node to HTML entities. Returns the target nodes.
Convert special HTML entities in the target node back to characters. Returns the target nodes.
Gets a value of a CSS property from the style attribute and sets it into an attribute for each of the target nodes. Each two parameters specify the name for the new attribute and the name of CSS property. Returns a list of matching nodes.
Transforms the target node with a background picture into an <img>
tag with an src
attribute. The target node must contain a style
attribute with the background. Returns a list of transformed nodes.
Transforms the content of the target node to the XML format. The contents must be in valid JSON format. The resulting XML tree will be inserted into the document. Returns the root element of the XML tree.
Parse the content of the target node in HTML format and insert it into the document. Returns the root element of the inserted HTML tree.
Combines each target node with its preceding node if such a node exists. You can use parameters to specify nodes to be inserted above the target node. If the parameter is in angular brackets, a new <tag>
node will be created. Otherwise a text element with the text specified by the parameter will be used.
Returns a list of nodes, preceding the target nodes.
Transforms the date and time from the text of the target node into a unixtime timestamp. The parameter specifies the timezone of the original date and time.
You can also pass a locale and a pattern to parse the date and time in more complicated cases. If a non-gregorian calendar is used, this needs to be specified in the locale. For example, "fa-IR@calendar=persian"
. Available patterns are documented here.
On success, returns a text element with the unixtime timestamp. Otherwise, returns the target element.
Note: This is a service function. There is no reason for you to use it in your templates. It was included in this reference to give you a better understanding of how the system works (see the
..after
block).
Processes the target nodes according to the Instant View format. Returns the target nodes.
If the target element is an <iframe>
with the attribute src
, the content of the iframe will be loaded. The target element will be replaced with the content of the iframe.
If the target node is an HTML-comment, a <comment>
element with the content of the comment will be created. The comment will be replaced by the newly created node.
You can use silent
parameter to ignore errors while processing this function. You will still see an error in the debug console, but the rules that come after will continue to execute.
Returns a list of replaced nodes.
Note: The @inline function adheres to the same-origin policy. This means that the target and the inlined pages should have the same origin. You can specify additional allowed origins using the option ~allowed_origin
Loads the content of the URL. The URL can be specified as a string or be the content of the target node.
You can use silent
parameter to ignore errors while processing this function. You will still see an error in the debug console, but the rules that come after will continue to execute.
Returns the newly created node with loaded content.
Note: The @load function adheres to the same-origin policy. This means that the target and the loaded pages should have the same origin. You can specify additional allowed origins using the option ~allowed_origin
Specifies that the target node contains essential content that can't be represented in the Instant View format. Returns the target nodes.
Tip: It is important to identify that a page contains essential unsupported content — no IV page will be generated to ensure that the user never gets incomplete info from an article. The system will take care of the most popular cases in the
..after
block, but your template must cover everything that the system doesn't catch.
The general format for a block function is the following:
Block functions usually accept the list of nodes returned by the XPath statement as a parameter. Depending on the function and its parameters, rules inside the block can be run several times or never. Block functions can contain any type of rules except conditions.
Below is a list of block functions that are supported in Instant View rules.
Executes the block of rules if target nodes exist on the current page. If target nodes do not exist, the block of rules will be skipped. The $$
and $@
variables contain target nodes found by the XPath query.
Executes a block of rules if target nodes do not exist on the current page. If such nodes exist, the block of rules will be skipped. The $$
and $@
variables contain target nodes found by the XPath query.
Executes a block of rules once per each target node found by the XPath query. At the beginning of each iteration, the following variables will be set:
$$
will contain the target nodes found by XPath query;$@
will contain the current target node;$index
will contain the index of the current target node (starts with 1);$first
will contain <true>
if the current target node is the first in the list and an empty list otherwise;$middle
will contain <true>
if the current target node is between the first and the last in the list, empty list otherwise;$last
would contain <true>
if the current target node is the last one in the list, empty list otherwise.Please note that the
@map
function should be used only if it is impossible to use regular functions with xpath queries (for example you need to use $index). Otherwise, regular functions are faster because they process several nodes at once.
Executes a block of rules n times. At the beginning of each iteration, the following variables will be set:
$$
and $@
will contain the previous value of $$
;$index
will contain the index of the current iteration (starts with 1);$first
will contain <true>
if this is the first iteration, an empty list otherwise;$middle
will contain <true>
if the current iteration is between the first and last, empty list otherwise;$last
will contain <true>
if this is the last iteration, empty list otherwise.Executes a block of rules while target nodes exist on the current page. At the beginning of each iteration the following variables will be set:
$$
and $@
will contain target nodes found by XPath query;$index
will contain the index of the current iteration (starts with 1);$first
will contain <true>
if it is the first iteration, an empty list otherwise.Executes a block of rules while target nodes do not exist on the current page. At the beginning of each iteration the following variables will be set:
$$
and $@
will contain target nodes found by XPath query;$index
will contain the index of the current iteration (starts with 1);$first
will contain <true>
if this is the first iteration, an empty list otherwise.Instant View supports widgets from popular services. We display them as embedded elements or specially formatted quotes. The Instant View bot analyzes all iframes in the document body and generates a widget if the service is supported.
Some popular widgets do not use iframes. Note that the
..after
block of rules contains rules to transform such widgets to an Instant View compatible format.
We currently support the following services:
All pages are processed according to the following rules:
If a page is on a third-level domain and above, the following rules are applied:
In other words, at first the bot attempts to use a block of rules that features the full domain name. If such a block does not exist, the bot checks for the next level up to the second-level domain.
..after
is a special block of rules that is applied to all pages irrespective of the domain name.
If the page is on a third-level domain or higher, you need to manually select the domain level to which your template will apply. Use this menu in the top left corner of the page:
Choose a level that hosts pages with the same structure, so that your rules are relevant to all the matching pages on this domain.
For example, use
wikipedia.org
to create an IV page forhttps://en.wikipedia.org/wiki/Domain_name
because the page structure doesn't depend on language in Wikipedia.