Skip to content

Commit

Permalink
Clarify preset variables
Browse files Browse the repository at this point in the history
  • Loading branch information
kepano committed Sep 30, 2024
1 parent 200ab2a commit edeb64c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ You can combine different types of patterns for a single template. The first mat

### Template variables

Template variables can be used to automatically pre-populate data from the page in a template. Variables can be used in the **note name**, **note location**, **properties**, and **note content**. Use the `...` icon in the extension popup to access the current page variable for use in templates.
Template variables can be used to automatically pre-populate data from the page in a template. Variables can be used in the **note name**, **note location**, **properties**, and **note content**. Use the `...` icon in the extension popup to access the current page variable for use in templates. There are several types of variables you can use: preset variables, meta variables, selector variables, and schema variables.

#### Page variables
#### Preset variables

These variables are automatically generated based on the page content. The main content variable is `{{content}}`, which contains the article content or the selection if there is any selected text on the page.
Preset variables are automatically generated based on the page content. These should work for nearly all websites. The main content variable is `{{content}}`, which contains the article content or the selection if there is any selected text on the page. Note that `{{content}}` attempts to extract the main content of the page, which may not always be what you want. In that case, you can use other preset variables or selector variables to extract the content you need.

| Variable | Description |
| ------------------- | ---------------------------------------------------- |
Expand All @@ -90,14 +90,14 @@ These variables are automatically generated based on the page content. The main

#### Meta variables

Meta variables allow you to extract data from meta tags in the page.
Meta variables allow you to extract data from meta tags in the page, including Open Graph data used to populate social share previews.

- `{{meta:name}}` returns the content of the meta name tag with the given name, e.g. `{{meta:name:description}}` for the `description` meta tag.
- `{{meta:property}}` returns the content of the meta property tag with the given property, e.g. `{{meta:property:og:title}}` for the `og:title` meta tag.

#### Selector variables

Selector variables allow you to extract text content from elements on the page using the syntax `{{selector:cssSelector?attribute}}`, where `?attribute` is optional. If no attribute is specified, the text content of the element is returned. You can also use `{{selectorHtml:cssSelector}}` to get the HTML content of the element.
Selector variables allow you to extract text content from elements on the page using the syntax `{{selector:cssSelector?attribute}}`, where `?attribute` is optional. If no attribute is specified, the text content of the element is returned. You can also use `{{selectorHtml:cssSelector}}` to get the HTML content of the element. Selector variables tend to work best on a specific website or set of websites that have consistent HTML structure.

- `{{selector:h1}}` returns text content of the first `h1` element on the page.
- `{{selector:.author}}` returns text content of the first `.author` element on the page.
Expand Down

0 comments on commit edeb64c

Please sign in to comment.