Targeting pages
By default a snippet runs on every public page. You can narrow that down in the Targeting tab of the editor in three ways, and a page must pass all three for the snippet to run:
- Paths: the page path must match an include pattern (if there are any) and no exclude pattern.
- Page kind: all pages, content pages only, or custom pages only.
- Locales: the page’s locale must be in the list (if there is one).
Include and exclude paths
Section titled “Include and exclude paths”Type a pattern and press Enter to add it.
- Include paths empty means every page.
- Exclude paths empty means no page is excluded.
- Exclude wins. If any exclude pattern matches, the snippet is not output, even when an include pattern also matches.
A pattern is either an exact path (/pricing) or a prefix ending in * (/blog/*).
| Pattern | Matches | Does not match |
|---|---|---|
/ |
/ |
/about |
/pricing |
/pricing, /pricing/ |
/pricing/teams |
/blog/* |
/blog/x, /blog/a/b |
/blog |
/* |
every page, including / |
— |
The full rules are in the path patterns reference.
Example: everywhere except checkout
Section titled “Example: everywhere except checkout”| Field | Value |
|---|---|
| Include paths | (empty) |
| Exclude paths | /checkout, /checkout/* |
Page kind
Section titled “Page kind”| Value | Admin label | Runs on |
|---|---|---|
all |
All pages | Every public page |
content |
Content pages | Pages whose layout passes kind: "content" (EmDash entries) |
custom |
Custom pages | Pages whose layout passes kind: "custom" |
The page kind comes from the kind your layout passes to createPublicPageContext. See
Theme setup.
Locales
Section titled “Locales”Add locale codes, such as en or fr, to run a snippet only on pages in those locales. Leave the list
empty to run on all locales.
Admin paths
Section titled “Admin paths”Nothing is ever output on /_emdash/ admin paths, whatever the targeting says.