← Back to all products
$19
Meta Tag Generator
Generate SEO-optimized meta tags including title, description, OG tags, and Twitter cards.
JSONMarkdownPythonCI/CD
📄 Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample📁 File Structure 9 files
meta-tag-generator/
├── LICENSE
├── README.md
├── examples/
│ └── site_config.json
├── free-sample.zip
├── guide/
│ ├── 01_features.md
│ ├── 02_configuration-reference.md
│ └── 03_cli-flags.md
├── index.html
└── src/
└── meta_tag_generator.py
📖 Documentation Preview README excerpt
Meta Tag Generator
Part of the SEO Toolkit by CodeVault
Generate comprehensive HTML meta tags, Open Graph tags, and Twitter Card tags from a simple JSON config file. Never hand-write meta tags again.
Features
- Generates all essential
meta tags from a single config - Full Open Graph support (og:title, og:image, og:type, etc.)
- Twitter Card tags (summary, summary_large_image)
- Validates your config and warns about common SEO mistakes
- Title length check (Google truncates at ~60 chars)
- Description length check (max 160 chars)
- Missing canonical URL detection
- Multiple output formats: tag block, full HTML document, JSON report
- Strict mode for CI/CD pipelines (exit 1 on any issue)
- Python stdlib only — zero dependencies
Quick Start
# Generate meta tags from a config file
python src/meta_tag_generator.py --config examples/site_config.json
# Generate a full HTML document
python src/meta_tag_generator.py --config examples/site_config.json --format html
# Validate without generating output
python src/meta_tag_generator.py --config examples/site_config.json --validate-only
# Output as JSON report (great for CI/CD)
python src/meta_tag_generator.py --config examples/site_config.json --format json
# Write to file
python src/meta_tag_generator.py --config examples/site_config.json --output head.html
Configuration Reference
Create a JSON file with these fields:
| Field | Type | Required | Description |
|---|---|---|---|
title | string | Yes | Page title (aim for 50-60 chars) |
description | string | Yes | Meta description (aim for 120-160 chars) |
charset | string | No | Character encoding (default: utf-8) |
viewport | string | No | Viewport settings (default: width=device-width, initial-scale=1.0) |
theme_color | string | No | Browser theme color (e.g., #00FF88) |
canonical_url | string | Yes | The canonical URL for the page |
language | string | No | HTML lang attribute (default: en) |
author | string | No | Page author |
robots | string | No | Robots directive (default: index, follow) |
keywords | array | No | List of keywords |
og_type | string | No | Open Graph type (default: website) |
og_title | string | No | OG title (falls back to title) |
og_description | string | No | OG description (falls back to description) |
og_image | string | Yes | OG image URL (1200x630 recommended) |
og_image_width | int | No | OG image width in pixels |
og_image_height | int | No | OG image height in pixels |
... continues with setup instructions, usage examples, and more.
📄 Code Sample .py preview
src/meta_tag_generator.py
#!/usr/bin/env python3
"""
Meta Tag Generator — SEO Toolkit by DataNest
Generate comprehensive HTML meta tags, Open Graph tags, and Twitter Card
tags from a simple JSON or YAML-like configuration. Outputs a ready-to-paste
<head> block or a standalone HTML file.
Why this exists:
Manually writing meta tags is tedious and error-prone. Miss one og:image
dimension and your social previews look broken. This tool generates all
the tags you need from a single config, validates required fields, and
warns you about common mistakes (missing descriptions, titles too long,
etc.) before you deploy.
Usage:
python meta_tag_generator.py --config site.json
python meta_tag_generator.py --config site.json --output head.html
python meta_tag_generator.py --config site.json --format json
License: MIT
"""
from __future__ import annotations
import argparse
import json
import logging
import sys
import html
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any
# ---------------------------------------------------------------------------
# Constants
# ---------------------------------------------------------------------------
# Google typically displays 50-60 characters for titles
TITLE_MAX_LENGTH = 60
TITLE_WARN_LENGTH = 50
# Meta descriptions should be 150-160 characters
DESC_MAX_LENGTH = 160
DESC_WARN_LENGTH = 120
# Common charset values
VALID_CHARSETS = {"utf-8", "iso-8859-1", "windows-1252", "ascii"}
# Supported Open Graph types (subset of og:type values)
# ... 467 more lines ...