AI for Meta Tags & Schema

Generate title tags, meta descriptions and JSON-LD with AI.

Repetitive on-page tasks are perfect for AI: writing title tags, meta descriptions, alt text and structured data at scale.

Great AI use cases

  • Draft multiple title/meta options to A/B test.
  • Generate JSON-LD for a given content type.
  • Write descriptive image alt text from a description.
  • Suggest internal links between related pages.

Always validate output

Check character limits, keyword fit and, for schema, run it through the Rich Results Test. AI can produce invalid JSON-LD or mis-typed properties.

Example

Example · html
<!-- AI-drafted meta, then human-reviewed for length and accuracy -->
<title>Pour Over Coffee Ratio: The Perfect Brew | SoundsCode</title>
<meta name="description" content="Use a 1:16 coffee-to-water ratio for balanced pour over. Here's how to weigh, grind and pour for a great cup.">

When to use it

  • A developer uses an LLM to generate title tags and meta descriptions for 2 000 product pages in a single batch API call, replacing empty CMS fields across the catalogue.
  • An SEO uses AI to convert a product page's structured content fields (name, price, category) into valid JSON-LD Product schema without writing the markup manually.
  • A content team prompts an AI to write 10 title tag variants for a single page then picks the one with the best keyword placement and character count.

More examples

Batch meta tag generation via AI API

Generating meta tags in batch via the Anthropic API replaces manual writing for large catalogues, with prompt rules enforcing character limits and keyword inclusion.

Example · bash
python3 - << 'EOF'
import anthropic, json

client = anthropic.Anthropic()  # reads ANTHROPIC_API_KEY from env

pages = [
    {"url": "/shoes/trail-runner-pro/", "product": "Trail Runner Pro", "category": "Trail Shoes", "price": "$129"},
    {"url": "/shoes/road-runner-lite/", "product": "Road Runner Lite", "category": "Road Shoes",  "price": "$99"},
]

for page in pages:
    prompt = f"""Write an SEO title tag and meta description for:
Product: {page['product']}
Category: {page['category']}
Price: {page['price']}
Rules: title <=60 chars, description <=155 chars, include product name in title."""
    # In production: call client.messages.create(model="claude-opus-4-5", ...)
    print(f"[Prompt ready for]: {page['url']}")
EOF

AI-generated JSON-LD Product schema

Providing structured product fields as prompt context lets an AI generate syntactically correct JSON-LD instantly, which can then be validated with the Rich Results Test.

Example · bash
# Prompt an AI to generate schema from product data
PROMPT="""Generate valid Schema.org JSON-LD for this product:
Name: Trail Runner Pro
Price: 129.99 USD
Availability: InStock
Rating: 4.7 / 5 from 312 reviews
Image URL: https://example.com/images/trail-runner-pro.jpg
Product URL: https://example.com/shoes/trail-runner-pro/

Output only the JSON-LD block, no explanation."""
echo "$PROMPT"
# AI output:
# { "@context":"...", "@type":"Product", "name":"Trail Runner Pro", ... }

Validate AI-generated meta tags

Validating AI-generated meta tags for character length before publishing catches outputs that exceed SERP display limits and need trimming.

Example · bash
python3 - << 'EOF'
ai_outputs = [
    {
        "url": "/shoes/trail-runner-pro/",
        "title": "Trail Runner Pro Trail Shoes - Free Shipping | Acme",
        "description": "Buy Trail Runner Pro trail shoes for $129. Lightweight, durable and built for technical terrain. Free shipping on orders over $75."
    }
]
for p in ai_outputs:
    t_len = len(p["title"])
    d_len = len(p["description"])
    t_ok = "OK" if t_len <= 60 else f"LONG ({t_len}ch)"
    d_ok = "OK" if d_len <= 155 else f"LONG ({d_len}ch)"
    print(f"Title [{t_ok}]: {p['title']}")
    print(f"Desc  [{d_ok}]: {p['description']}")
EOF

Discussion

  • Be the first to comment on this lesson.