Meta-title Generator

 

 

Meta-title Generator

Updated 21 May 2025

0. Purpose

  • Generate consistent, SEO-friendly <title> tags that stay ≤ 60 chars / ≤ 580 px.
  • Place the primary keyword first, USP suffix last, with no misleading delivery claims.
  • Fail gracefully & log outliers for manual review.

1. Inputs & validation

Var Source Validation / fallback
primary_kw H1 or first breadcrumb segment Required.
Strip HTML/special chars.
If empty or len > 40 → use category.capitalize() and log WARN_EMPTY_PRIMARY.
secondary_kw Curated semantic list Optional.
Strip HTML/special chars.
Trim to ≤ 20 chars.
price Feed field lowest_price Numeric only. Formatter prepends “From £{price}”. If blank → ignore.
category Top-level slug Must be buildings / furniture / bbqs / accessories. Unknown → other + suffix “Shop Online”.
delivery_time Feed field days_to_dispatch Integer ≥ 0. Blank → 999.

2. Suffix pool & accuracy guard

suffix_pool = {
    "buildings":   "10-Yr Guarantee",
    "furniture":   "Fast UK Delivery",
    "bbqs":        "24-Hr Dispatch",
    "accessories": "Next-Day Delivery",
    "other":       "Shop Online"
}

suffix = suffix_pool.get(category, "Shop Online")

# accuracy guard – kill speed claims if >5-day dispatch
if delivery_time > 5 and suffix.startswith(("Fast", "24-Hr", "Next-Day")):
    suffix = price or "Shop Online"

3. Draft title construction

  1. Start with primary_kw.
  2. If secondary_kw exists → append & {secondary_kw}.
  3. If price exists and current length < 45 → append – {price}.
  4. Always append | {suffix}.

Pseudo-code

title = primary_kw
if secondary_kw:
    title += f" & {secondary_kw}"
if price and len(title) < 45:
    title += f" – {price}"
title += f" | {suffix}"

4. Length guardrail (60 chars hard cap)

  1. If len(title) > 60 trim in order:
    1. Remove price block.
    2. Remove secondary_kw block.
    3. Still long? drop the suffix entirely.
  2. If still > 60: right-truncate primary_kw & append “…”; log WARN_OVERSIZE.

5. Worked examples

Category Inputs Final title Len
Buildings KW = Wooden Sheds; price = £299 Wooden Sheds – From £299 | 10-Yr Guarantee 46
Furniture (fast) KW = Rattan Sofa Set; price = £499; dispatch = 3 Rattan Sofa Set – From £499 | Fast UK Delivery 55
BBQs (slow) KW = Gas BBQs 4-Burner; price = £349; dispatch = 14 Gas BBQs 4-Burner | From £349 34
Broad cat. KW = Wooden Sheds; 2nd KW = Garden Storage Wooden Sheds & Garden Storage | 10-Yr Guarantee 49
Long KW KW = Extra-Large Pressure-Treated Overlap Wooden Workshop Shed; price = £999 Extra-Large Pressure-Treated Overlap Wooden Workshop Shed… 60

6. Output

Write the final string to the page’s <title>; leave all other HTML unchanged.

7. Logging & error handling

  • Log WARN_EMPTY_PRIMARY, WARN_OVERSIZE etc. with page URL for weekly SEO audit.

8. Unit-test checklist

  • Empty primary_kw → falls back to category, logs warning.
  • Secondary_kw > 20 chars → trimmed.
  • BBQ item with dispatch = 10 days → no speed suffix.
  • 25 random URLs → Screaming Frog SERP Snippet → zero pixel truncation.

9. Manual override

If a cell in Google Sheet “Meta Titles Overrides”  → column New Title contains text, use it verbatim and skip generation logic.

10. Manual Brainstorming

A good starting point for ideas can be found here: https://ahrefs.com/writing-tools/seo-title-generator