Logo Text Blaze

  • Docs
  • Community
  • Business
  • Documentation

    No search results

    Text Blaze

    Loading...

    Data Blaze

    Loading...

    Community Forums

    Loading...
  • Products
    • Text Blaze
      Snippets and templates
    • AI Blaze
      AI writing and editing
    • Data Blaze
      Tables and sheets
    Downloads
    • Add to Chrome
    • Windows app
    • MacOS app
  • By function
    • Support & operations
    • Sales
    • Healthcare
    • Education
    • Recruiting
    • Marketing
    Business
    • For teams
  • Resources
    • Documentation
    • Community forum
    • Gallery
    • Contact us
  • Pricing

Documentation

No search results

Text Blaze

Loading...

Data Blaze

Loading...

Community Forums

Loading...
Add to Chrome –  It's Free! Go to Dashboard ›
Docs > Commands
  • Guides
    • Quick Start
    • Sharing Snippet Folders
    • Dynamic Commands
    • Date and Time
    • Autopilot
    • Forms
    • Formulas
    • Rules & Validation
    • Tables in Snippets
    • Connect Other Apps
    • Tidying Whitespace
    • Lists
    • Read Data from Websites
    • Teams and Organizations
  • Tutorial Videos
  • Gallery
  • Frequently Asked Questions
  • Formula Reference
  • Dynamic Commands
    • Using Dynamic Commands
    • {=} (Formula Command)
    • {button}
    • {click}
    • {clipboard}
    • {cursor}
    • {error}
    • {formdate}
    • {formmenu}
    • {formparagraph}
    • {formtext}
    • {formtoggle}
    • {if}
    • {import}
    • {key}
    • {link}
    • {note}
    • {repeat}
    • {run}
    • {site}
    • {snippet}
    • {time}
    • {user}
    • {wait}
  • Connected Snippets
    • Connected Snippets Overview
    • {image}
    • {urlload}
    • {urlsend}
    • {dbselect}
    • {dbinsert}
    • {dbupdate}
    • {dbdelete}
  • Command Packs
    • Capitalize
    • Gmail
    • LinkedIn
    • Randomize
Commands

{site}

Summary: Inserts information about the current webpage into your snippet.
Sample Usage
Page URL: {site:url}
Page Domain: {site:domain}
Page Path: {site:path}
Page Title: {site:title}
_

Quick Overview Video

Settings


Setting NameTypeDescription
PositionaltextThe type of page information to get.
frameself/topWhich frame to get information from (defaults to top).
selectortextA CSS selector for use with the html or text types.
multipleyes/noWhen selector is specified, whether to return multiple results or just the first result (defaults to no).
General Command Settings
trimyes/no/left/rightIf yes whitespace is removed before and after the command. If left, only whitespace to the left is removed. If right, only whitespace to the right is removed.

Getting information from a web page is extremely useful in further automating your snippets.

For example, if you're using Text Blaze on your chat application, you could set it up to get specific information, like a name, email, or something else, present on the web page to use in your snippet

Throughout this documentation page, you will get several examples to help you see the {site} command's usefulness.

{site} is an advanced Text Blaze command that assumes some familiarily with fundamental web concepts like HTML, CSS, URLs, and Regular Expressions.

Getting specific information from a web page

The first setting supported by the {site} command is a positional setting that tells the command the type of information to get from the web page.

The table below displays the 9 different supported values that this command takes:

TypeDescriptionExample for url https://test.com/my/page?foo=1#part
urlThe full url of the page.https://test.com/my/page?foo=1#part
domainThe domain of the url.test.com
pathThe path of the url./my/page
protocolThe protocol of the url.https
queryThe query of the url.?foo=1
hashThe hash of the url.#part
htmlThe html of the webpage.<html>...</html>
textThe text of the webpage.Welcome to...
titleThe title of the webpage.Site Title

Capitalization is important. For example, you can use {site: url} to get the web page's URL, but doing {site: URL} will not work.

Getting Information from the URL

The url, domain, path, protocol, query, and hash values are all concerned with getting information the URL of the current web page.

Here are the properties you can retrieve information for represented visually:

This information can be used in a variety of ways. For example, you could combine it with the {if} command to only insert information if you're on a specific part of the web page.

Including the Page Contents in your Snippet

The next two values that you can use in the {site} command's positional setting are text and html.

These two are not related to the URL, but instead get contents of the web page.

You can use them to dynamically populate parts of your snippets.

For example, if you use a Text Blaze snippet within your email application, you could use it to include information about the email recipient's name in your snippet.

To illustrate the usage of text and html in the {site} command, we're going to consider some HTML typical of what you might see on a site:

The text and html types are both in Beta and their functionality may change in the future.

In particular, we are exploring possibilities to include nested <iframe> content in each of them and the possibility of including nested <input> and <textarea> elements directly in the text type.

Sample HTML:
<div class="user-info">
  Name: <span class="name">John Smith</span>
  <ul class="favorites">
    <li>Oreos</li>
    <li>Twizzlers</li>
    <li>Snickers</li>
  </ul>
</div>
How the above sample HTML would render in a web page:
User Name: John Smith
  • Oreos
  • Twizzlers
  • Snickers

We can use the {site} command to extract information from this sample. {site: text} and {site: html} will give you access to all the contents of the page. For example:

Page Contents
HTML for whole page (truncated for readability): {=substring({site: html}, 1, 50)}...

Text for whole page (truncated for readability): {=substring({site: text}, 1, 50)}...
_
The above example is using the {site} command on the Text Blaze website so the contents will be related to this web page.

Also, one very important thing to note is that the text type pulls text content from the page. This does not include contents inside of <input> or <textarea> HTML tags. To include the contents of these elements, you need to specify a selector that specifically selects one of these elements and not a parent element. We'll review selectors in the next section.

Getting specific parts of a page

Using {site: html} or {site: text} will give you the entire contents of the page.

Generally, though you just want to get a specific part of the contents of the page, like a name or address. Text Blaze has two ways to do that: CSS Selectors and Regular Expressions.

If you do use html or text as the value for the {site} command's positional setting you have access to 2 additional named settings.

Those named settings are selector and multiple. These 2 named settings are concerned with how to get the contents of the page.

Using CSS Selectors to Get Part of the Page

One way that Text Blaze can access specific parts of the page is with CSS selectors. CSS selectors provide a very concise method of getting specific parts of a page.

The details of CSS selectors are out of the scope of this documentation, and we refer you to this website to understand them in more detail.

Fortunately, for most use cases, Text Blaze can automatically create the right selector for you with point and click. Just use the "Select from website" feature of Text Blaze and click on the desired part of the page.

Here is an animation showing how this works:

Site Selector Animation

Once you have your selector, the snippet automatically populates its contents when used. For example, in the html sample from the previous section, you can get the name using a CSS selector. You can also use another CSS selector to get different parts of the favorites list.

Using CSS Selectors
Using a CSS selector to get the user's name: {site: text; selector=.user-info .name}

Using a CSS selector to get the first favorite item: {site: text; selector=.user-info .favorites li}
_

Getting more than one element with the multiple setting

Notice how in the above CSS selectors example that using .user-info .favorites li gets the first item in the favorites list even though multiple elements have the same CSS selector.

There is where the named setting multiple comes in. If multiple is no or omitted only the first match will be returned.

If multiple is yes all the matches will be returned as a list.

Using the multiple setting
Using a CSS selector to get all the favorite items as a list: {site: text; selector=.user-info .favorites li; multiple=yes}
_

Handling Errors

If multiple is no and there is no match for that specific CSS selector on the web page you're using the snippet on, an error will be displayed.

Text Blaze provides you with catch(), a predefined function to help you deal with an error scenario. You can use it to provide a default value in an error case in your formulas:

CSS Selector Error Handling
Error shown: {site: text; selector=.does-not-exist}

Error caught and replaced with another value: {=catch({site: text; selector=.does-not-exist}, "My Default Value")}
_

If multiple is set to yes, on the other hand, and there is no match, Text Blaze will return an empty list ([]).

Controlling where information is loaded from using the frame setting

One last setting that the {site} command gives you access to is frame.

Web pages can embed other web pages (called 'frames'). If you use a Text Blaze snippet inside of a frame, you can use the frame named setting to load information either the frame (by setting the frame setting to self) or from the web page embedding the frame (by setting the frame setting to top).

Using the frame setting affects the output of both domains and also the page contents.

If Text Blaze is used in a normal web page without frames, both self and top are equivalent. Text Blaze defaults to top. This will return the URL you see in Chrome's URL bar.

Using Regular Expressions to Get Part of the Page

Regular expressions are a powerful way to search through text and find specific patterns of text.

For example, if you're looking for a phone number or an email address (both pieces of textual content that follow a specific pattern), then regular expressions can help you find those.

The following video will help you further understand how Regular Expressions work.

Text Blaze has an extractregex() predefined function that takes two string parameters.

If you use {site: text} or {site: html}, then you can use Regular Expressions as an alternative to CSS selectors to retrieve a specific part of the web page.

For example, if you want to get the name from the html sample in the previous section, you can use the following regular expression: "Name: ([\w ]+)".

This tells Text Blaze, that we want all the text after the text "Name: " that consists of spaces or letter characters.

Using Regular Expressions
Using a regular expression to get just the user's name.

Name from the page: {=extractregex({site: text}, "Name: ([\w ]+)")}
_

You can read more about regular expressions in our Blaze Formula Language Reference, reading our non-scary guide on the community forums, and watching the above video. Also, there are some great online resources you can use to learn more about them.

About

Plans and Pricing
Sharing Snippets
Text Blaze for Business
Forms
Autopilot
Dynamic Commands
Command Packs
Text Blaze for Windows
Text Blaze for macOS

Support

Get Started with Text Blaze
Contact Us
Documentation
Community Forum
Blog
Gallery
Engineering Blog

Solution for

Business
Customer Support
Recruiters
Education
Healthcare
Sales
Property Managers
AI

Other

Privacy Policy
Terms of Service
Open Source Licenses
Affiliate
© Blaze Today Inc