Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
enderpuentes avatar

Json Ld

  • 14 installs
  • Updated June 23, 2026
  • enderpuentes/ai-agent-skills

Helps with ai & agent building tasks.

About

json-ld is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted development.

  • json-ld
  • AI & Agent Building
  • AI-coding skill

Json Ld by the numbers

  • 14 all-time installs (skills.sh)
  • Ranked #11,296 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
  • Data as of Jul 24, 2026 (Skillselion catalog sync)
npx skills add https://github.com/enderpuentes/ai-agent-skills --skill json-ld

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs14
Last updatedJune 23, 2026
Repositoryenderpuentes/ai-agent-skills

What it does

Helps with ai & agent building tasks.

Files

SKILL.mdMarkdownGitHub ↗

JSON-LD

Overview

JSON-LD (JSON for Linked Data) is a W3C standard for embedding machine-readable metadata in JSON. On the web it is most often used with the schema.org vocabulary inside <script type="application/ld+json"> so search engines understand page content and may show rich results.

Principles: Valid JSON first; @context maps terms to IRIs; @type declares entity kind; prefer absolute URLs for @id and links; markup must match visible page content.

Reference: W3C JSON-LD 1.1 · schema.org · Google structured data intro

---

Minimal document

Every JSON-LD document needs @context and usually @type:

{
  "@context": "https://schema.org",
  "@type": "Organization",
  "name": "Acme Corp",
  "url": "https://example.com",
  "logo": "https://example.com/logo.png"
}

For schema.org, use "@context": "https://schema.org" (or "https://schema.org/").

---

Embedding in HTML

Per the JSON-LD spec, place JSON in a script element with type="application/ld+json". Multiple scripts on one page are merged into a single dataset.

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "WebPage",
  "name": "About Us",
  "url": "https://example.com/about"
}
</script>
  • Put in <head> or <body>; both are valid.
  • Content must be valid JSON (double quotes, no trailing commas, no comments).
  • Escape </script> inside strings if needed (e.g. split as <\/script>).

Next.js (App Router)

Use a dedicated component or inline in layout.tsx / page.tsx:

export function JsonLd({ data }: { data: Record<string, unknown> }) {
  return (
    <script
      type="application/ld+json"
      dangerouslySetInnerHTML={{ __html: JSON.stringify(data) }}
    />
  )
}
  • Build the object in TypeScript; JSON.stringify handles escaping.
  • For dynamic pages, derive name, url, datePublished, etc. from route params and CMS data.
  • Site-wide schemas (Organization, WebSite) belong in root layout.tsx; page-specific schemas in each page.tsx.

---

Core keywords (JSON-LD 1.1)

KeywordPurpose
@contextVocabulary and term mappings (required at document or node level)
@typeEntity type (e.g. WebPage, Person, Product)
@idCanonical IRI for the entity; use for cross-references
@graphArray of node objects in one document
@language / @valueLanguage-tagged or typed literals (advanced)

Node references — link entities without duplication:

{
  "@context": "https://schema.org",
  "@graph": [
    {
      "@type": "WebSite",
      "@id": "https://example.com/#website",
      "url": "https://example.com",
      "name": "Example",
      "publisher": { "@id": "https://example.com/#organization" }
    },
    {
      "@type": "Organization",
      "@id": "https://example.com/#organization",
      "name": "Example Inc.",
      "url": "https://example.com"
    }
  ]
}

Use stable fragment IDs (#website, #organization) for site-level entities.

---

Common schema.org types (web)

Add only types that match visible page content. For Google rich results, follow Google's feature docs (required/recommended fields differ per type).

TypeTypical use
OrganizationCompany / brand (logo, sameAs social URLs)
WebSiteSite identity; optional SearchAction for sitelinks search box
WebPageGeneric page; pair with isPartOf → WebSite
Article / NewsArticle / BlogPostingArticles and blog posts
BreadcrumbListBreadcrumb navigation
ProductE-commerce product pages
FAQPageFAQ sections with Question / Answer
LocalBusinessPhysical business (address, hours, geo)
PersonAuthor or profile pages
VideoObjectVideo embed pages
RecipeRecipe pages

WebSite + Organization (root layout)

{
  "@context": "https://schema.org",
  "@graph": [
    {
      "@type": "WebSite",
      "@id": "https://example.com/#website",
      "url": "https://example.com",
      "name": "Example",
      "publisher": { "@id": "https://example.com/#organization" }
    },
    {
      "@type": "Organization",
      "@id": "https://example.com/#organization",
      "name": "Example Inc.",
      "url": "https://example.com",
      "logo": {
        "@type": "ImageObject",
        "url": "https://example.com/logo.png"
      }
    }
  ]
}

Article / BlogPosting

{
  "@context": "https://schema.org",
  "@type": "BlogPosting",
  "headline": "Post title",
  "description": "Short summary",
  "image": ["https://example.com/og.jpg"],
  "datePublished": "2025-06-13",
  "dateModified": "2025-06-13",
  "author": {
    "@type": "Person",
    "name": "Jane Doe",
    "url": "https://example.com/about"
  },
  "publisher": { "@id": "https://example.com/#organization" },
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "https://example.com/blog/post-slug"
  }
}

BreadcrumbList

{
  "@context": "https://schema.org",
  "@type": "BreadcrumbList",
  "itemListElement": [
    {
      "@type": "ListItem",
      "position": 1,
      "name": "Home",
      "item": "https://example.com"
    },
    {
      "@type": "ListItem",
      "position": 2,
      "name": "Blog",
      "item": "https://example.com/blog"
    },
    {
      "@type": "ListItem",
      "position": 3,
      "name": "Post title"
    }
  ]
}

---

Validation workflow

1. Syntax — ensure valid JSON (no comments, trailing commas). 2. [JSON-LD Playground](https://json-ld.org/playground/) — expand/compact; debug @context and graph structure. 3. [Google Rich Results Test](https://search.google.com/test/rich-results) — eligibility for Google rich results (when targeting SEO). 4. Search Console — monitor rich result status after deploy.

For programmatic checks in Node.js, use the `jsonld` package (jsonld.expand, jsonld.compact).

---

Google / SEO guidelines (summary)

  • JSON-LD is Google's recommended format for structured data when you can choose.
  • Markup must describe content visible on the page; no hidden or misleading data.
  • Prefer complete required fields over stuffing optional properties with weak data.
  • Use Google's type-specific docs for required properties — they can be stricter than schema.org.
  • data-vocabulary.org is deprecated for Google rich results; use schema.org.

---

Common mistakes

  • Invalid JSON — comments, single quotes, trailing commas break parsers.
  • Relative URLs — use absolute URLs for url, image, @id, and item in breadcrumbs.
  • Mismatch with UIheadline, prices, ratings, or FAQ answers that don't match the page.
  • Duplicate conflicting graphs — multiple scripts defining the same @id with different data.
  • Wrong `@type` — e.g. Article on a product page; pick the type that matches primary content.
  • Missing `@context` — every standalone document needs it.
  • Escaping in HTML — raw </script> in JSON strings breaks the script tag; use JSON.stringify.

---

Advanced (when needed)

  • Framing — reshape expanded data with a JSON-LD frame (W3C Framing spec).
  • Custom vocabulary — define @context with term mappings for non–schema.org IRIs.
  • HTTP headersLink with rel="alternate"; type="application/ld+json" for non-HTML resources (API, PDF).
  • RDF interop — JSON-LD serializes RDF; use expanded form and N-Quads when integrating with RDF tools.

Related skills

  • sitemap — XML sitemap for crawl discovery.
  • llms-txt — llms.txt for AI/agent context (complements, does not replace, JSON-LD).

---

Additional resources

  • reference.md — W3C specs, schema.org, Google Search Central, tools, npm libraries.
  • W3C JSON-LD 1.1: https://www.w3.org/TR/json-ld11/
  • JSON-LD Playground: https://json-ld.org/playground/
  • schema.org: https://schema.org/
  • Google structured data: https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.