SEO & Structured Data Cheat Sheet
Quick reference for on-page SEO: robots.txt, meta tags, sitemap.xml, Open Graph, and JSON-LD structured data for search engines.
Search-engine visibility comes from three layers: crawl control (robots.txt, sitemaps), on-page metadata (titles, descriptions, Open Graph), and machine-readable structured data (JSON-LD). Each layer is independent and should be tested after deployment.
robots.txt
robots.txt tells crawlers which paths to ignore. It is a hint, not a security boundary — sensitive pages must also be protected by auth.
User-agent: *
Allow: /
Disallow: /private/
Disallow: /api/
Sitemap: https://www.example.com/sitemap.xml
| Rule | Purpose |
|---|---|
User-agent: * | Applies to all crawlers |
User-agent: Googlebot | Applies to Google's crawler only |
Allow: /public/ | Explicitly allow, even after a parent Disallow |
Disallow: /admin/ | Block a path subtree |
Sitemap: <url> | Advertise the sitemap location |
Open Graph & Twitter Cards
Social crawlers read Open Graph for link previews. og:image should be 1200×630 with a 1.91:1 ratio.
<meta property="og:type" content="website" />
<meta property="og:title" content="Free Online Tool" />
<meta property="og:description" content="Short social description." />
<meta property="og:url" content="https://www.example.com/tool" />
<meta property="og:image" content="https://www.example.com/og.png" />
<meta property="og:site_name" content="Example" />
<meta name="twitter:card" content="summary_large_image" />
sitemap.xml
A sitemap lists indexable URLs and optional metadata like lastmod and priority. Keep images/videos in the same file or separate sitemaps.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.example.com/tool</loc>
<lastmod>2026-08-11</lastmod>
<changefreq>weekly</changefreq>
<priority>0.8</priority>
</url>
</urlset>
JSON-LD Structured Data
JSON-LD is a <script type="application/ld+json"> block in the <head>. Escape < as \u003c when serializing. Below are the three most common types.
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "How to Write a Cheat Sheet",
"author": { "@type": "Person", "name": "Ada" },
"datePublished": "2026-08-11T09:00:00Z",
"image": "https://www.example.com/og.png"
}
</script>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [
{
"@type": "Question",
"name": "What is JSON-LD?",
"acceptedAnswer": {
"@type": "Answer",
"text": "JSON-LD is a way to embed structured data in the page head."
}
}
]
}
</script>
Common Pitfalls
[!WARNING]
robots.txtblocks do not keep pages out of search if they are linked — and blocking CSS/JS (Disallow: /_next/) can break rendering and ranking. Only block genuine private paths.
[!TIP] Validate every page after deploy: Rich Results Test for structured data, Google URL Inspection for the live-rendered HTML, and the Open Graph Debugger / card validator for social previews.