# SEO - Custom Tags

> Pattern-based meta tag injection for any URL — custom titles, descriptions, robots directives and OpenGraph fields without touching templates or code.

## General Information

Magento gives you meta-tag fields on products, categories and CMS pages — and stops there. Filtered category pages, search-results pages, customer account pages, paginated archives, custom routes from third-party modules: none of them have an admin-accessible way to control meta titles, descriptions, robots directives or OpenGraph tags.

The Qoliber SEO Custom Tags extension closes that gap. From a single admin grid, your team can set and override meta tags for any URL on the storefront — by exact match, by wildcard pattern, or scoped to specific page types and customer groups. No developer involvement, no template overrides, no surprises.

## What Does This Extension Do?

- **Centralised meta-tag grid** at **Marketing → SEO → Dynamic Tags** for full CRUD of custom tag rules.
- **URL pattern matching** — exact match (`/sale/black-friday`) or wildcard patterns (`/shop/watches/*`).
- **Page-type filtering** — target products, categories, CMS pages, custom-route pages independently.
- **Override anything Magento emits** — meta title, meta description, meta keywords, robots directives, OpenGraph fields. First matching rule wins.
- **Customer-group awareness** — apply different meta tags to wholesale vs. retail, B2B vs. B2C.
- **Active / inactive toggle** — pause a rule for the holidays without deleting it.
- **Sort-order priority** — when multiple rules match, you decide which one applies.

## Why Is This a Game Changer?

- **Marketing-team-friendly.** Anyone who can use a spreadsheet can manage meta tags for any URL on the store. No JIRA tickets, no developer hand-offs, no deployments.
- **Goes where Magento can't.** Filtered URLs, search results, login pages, paginated archives — all addressable by pattern.
- **Safe by default.** Rules are inactive until you turn them on, and the robots-directive whitelist (added in 2.1) blocks accidental `noindex` of your homepage.
- **Plays well with the rest of the suite.** Integrates with `SeoOpengraphTags` for social-card overrides and `SeoRichSnippets` for canonical-aware structured data.

## How Does It Work?

When a page renders, the module checks the request URL against every active rule (in priority order) and applies the first match. Whatever fields the rule sets — title, description, robots, OG tags — replace whatever Magento was about to emit. Fields the rule leaves blank fall through to Magento's defaults, so partial overrides are safe.

### Example

| Pattern | Page type | Meta title override |
|---------|-----------|---------------------|
| `/shop/watches/men/*` | Category | "Men's Watches — Free Shipping Over £100 \| MyStore" |
| `/sale` | CMS page | "End-of-Season Sale — Up to 60% Off" |
| `/blog/*` | Custom | (sets `noindex,follow` on every blog page during a content rewrite) |

### Configuration at a glance

Find the rule grid at **Marketing → SEO → Dynamic Tags** and the global module settings under **Stores → Configuration → Qoliber → SEO: Dynamic Tags**.

## What's New in 2.1

- **Stored XSS prevention** — `meta_title`, `meta_description` and `meta_keywords` are now sanitised on save (`strip_tags()` plus control-character stripping).
- **Robots-directive whitelist** — only canonical combinations (`INDEX,FOLLOW`, `NOINDEX,FOLLOW`, etc.) are accepted; arbitrary values rejected at save time.
- **Path-normalisation contract locked** with 13 unit-test cases covering edge cases in `preventRelativePath()`.
