Rule: structured-data-valid
Having JSON-LD on your page is necessary but not sufficient. If it lacks the required @context and @type fields, search engines silently ignore it. You think you have structured data; Google thinks you don't. This rule catches the most common structural errors in JSON-LD.
What it checks
For every <script type="application/ld+json"> block found on the page, Indxel parses the JSON and checks: (1) the JSON is syntactically valid, (2) an @context field exists (should be 'https://schema.org'), and (3) an @type field exists. If any block fails these checks, the rule triggers a warning.
Thresholds
All JSON-LD blocks have valid JSON with @context and @type
One or more JSON-LD blocks are missing @context or @type
Edge cases
If structured-data-present fails (no JSON-LD at all), this rule is skipped.
Nested @type in @graph arrays: Indxel checks the top-level @type and also inspects @graph items for their own @type. A top-level @graph without a @type is valid if each graph item has @type.
@context can be 'https://schema.org' or 'http://schema.org'. Both are accepted. Google prefers https but accepts both.
JSON-LD with a syntax error (missing comma, extra bracket) fails parsing entirely. Indxel treats this as invalid.
Configuration
// indxel.config.ts
import { defineSEO } from "indxel";
export default defineSEO({
rules: {
"structured-data-valid": true, // enabled by default
},
});
// Ensure every JSON-LD block has @context and @type:
const schema = {
"@context": "https://schema.org", // required
"@type": "FAQPage", // required
mainEntity: [/* ... */],
};Frequently asked questions
What if my JSON-LD uses @graph?
Indxel handles @graph arrays. If the top-level object has @context and uses @graph, each item in the graph is checked for @type. This is a common pattern for combining multiple schema types in one block.
Can I use http:// for @context?
Google accepts both 'http://schema.org' and 'https://schema.org' for @context. Indxel accepts both. However, Google's documentation recommends https, so prefer 'https://schema.org'.