Magento meta title and description templates for products, categories, and CMS pages
A meta template fills in a page’s title or description when the page has none of its own. A large catalog rarely has a hand-written meta title on every product; a template such as {{name}} {{sep}} {{store_name}} gives every one of them a sensible title without touching the products themselves.
Templates are set in Stores > Configuration > OCM Labs > SEO > Meta Templates, one title and one description template each for products, categories, and CMS pages, at default, website, or store view scope.
Which value wins
- A meta title or description entered on the product, category, or page always wins.
- Otherwise, the matching template is rendered with the page’s data.
- If the template is empty, Magento’s own value is left in place.
Templates are applied when the page is rendered and are never saved into your products, categories, or pages. Change a template and every page that relies on it changes with it, once the full page cache is flushed.
Variables
| Variable | Value |
|---|---|
{{name}} | Product or category name, or CMS page title |
{{sku}} | Product SKU (products only) |
{{price}} | Product price (products only) |
{{category}} | Category name; for a product, the category it is viewed in, otherwise its first assigned category |
{{parent_ | Name of the parent category (empty for top-level categories) |
{{store_ | Store view name |
{{sep}} | The Separator set in configuration, | by default |
{{attribute:<code>}} | The storefront value of an attribute, for example {{attribute:short_ |
Empty or unknown variables render as nothing, and a separator left dangling by an empty variable is removed, so {{name}} {{sep}} {{category}} on a product with no category renders as just the name. Output is plain text.
Which attributes can be used
{{attribute:<code>}} works for:
- Any product or category attribute with Visible on Catalog Pages on Storefront set to Yes.
- An allowlist that always works:
name,sku,short_description,description,meta_title,meta_description,manufacturer,color, andsize.
Back-office-only attributes such as cost are never exposed. For CMS pages, {{attribute:<code>}} works only for title, content_heading, meta_title, meta_description, and meta_keywords.
Defaults
| Page type | Title template | Description template |
|---|---|---|
| Product | {{name}} {{sep}} {{store_ | {{name}} at {{store_ |
| Category | {{name}} {{sep}} {{store_ | Shop {{name}} at {{store_ |
| CMS page | {{name}} {{sep}} {{store_ | (empty) |
Examples
A product title that leads with the name and adds the brand:
{{name}} by {{attribute:manufacturer}} {{sep}} {{store_name}}A category description:
Shop {{name}} in {{parent_category}} at {{store_name}}. Free returns on every order.Templates and the SEO panel
The SEO panel scores the page’s own meta title and description. A page that relies on a template has an empty meta title, so the panel’s title checks fall back to the name, and the description checks see an empty description. Write a meta title and description for the pages that matter most and let templates cover the rest of the catalog.