Assign meta tags based on URL path patterns with wildcard support.
Requirements
- Metatag module
Installation
Install as usual, see Installing modules.
Configuration
- Navigate to Administration › Configuration › Search and metadata › Metatag
- Click "Add metatag for path pattern"
- Enter a label, machine name, path pattern, and "Replace empty token results"
- Save and configure the meta tags for the pattern
Pattern Syntax
Prefix Match (trailing /)
Matches all paths under a prefix at any depth.
| Pattern | Matches |
|---|---|
/news/ |
/news/article, /news/sports/scores |
/about/team/ |
/about/team/john, /about/team/marketing/lead |
Wildcard Match (*)
Matches exactly one path segment.
| Pattern | Matches | Does Not Match |
|---|---|---|
/blog/* |
/blog/post-1 |
/blog, /blog/a/b |
/user/*/edit |
/user/5/edit |
/user/edit |
Partial Wildcard Match
Use * within a segment to match part of it.
| Pattern | Matches | Does Not Match |
|---|---|---|
/blog/post-* |
/blog/post-1, /blog/post-2 |
/blog/other, /blog/post-1/extra |
/blog/post-*/ |
/blog/post-1/part-2, /blog/post-2/part-2/section-1 |
/blog/other/part-2 |
Precedence
When multiple patterns match, the most specific wins (longest non-wildcard path).
Path-based metatags are applied above global defaults but below entity-specific,
and route-specific metatags. The path-based metatags takes precedence over the
bundle, and entity type metatags.
Replace Empty Token Results
When creating a path pattern, you can enable the "Replace Empty Token Results" option. This is useful when entities have a metatag field with token-based values that may resolve to empty.
When enabled:
- If an entity's metatag contains a token (e.g., [node:title])
- And that token resolves to an empty value
- The path-based tag value will be used instead
This allows path-based defaults to act as fallbacks for missing token values.
Project information
- Project categories: Search engine optimization (SEO)
- Ecosystem: Metatag
20 sites report using this module
- Created by ajits on , updated
Stable releases for this project are covered by the security advisory policy.
There are currently no supported stable releases.
Releases
Development version: 1.0.x-dev updated 26 Feb 2026 at 06:37 UTC

