DevTools Logo

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.

Web & Network
seo
structured-data
json-ld

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.

text
User-agent: *
Allow: /
Disallow: /private/
Disallow: /api/
Sitemap: https://www.example.com/sitemap.xml
Table
RulePurpose
User-agent: *Applies to all crawlers
User-agent: GooglebotApplies 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

Essential Meta Tags

html
<title>Product Name — Free Online Tool | Example</title>
<meta name="description" content="Action verb + benefit + CTA, under 160 characters." />
<meta name="robots" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1" />
<link rel="canonical" href="https://www.example.com/products/tool" />
Table
TagGuidance
<title>≤ 60 chars, primary keyword front-loaded
meta description≤ 160 chars, includes a call to action
rel="canonical"Point to the canonical URL to avoid duplicate content
meta robotsindex, follow by default; use noindex for thin/duplicate pages
lang attributeSet on <html> (e.g. lang="en")

Open Graph & Twitter Cards

Social crawlers read Open Graph for link previews. og:image should be 1200×630 with a 1.91:1 ratio.

html
<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
<?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.

html
<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>
html
<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.txt blocks 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.

References