SDK
Structured Data
Generate JSON-LD structured data for search engines and LLMs.
generateLD(type, data)
Generate a JSON-LD object for any supported schema type. The output includes @context and @type automatically.
| Parameter | Type | Description |
|---|---|---|
| type* | StructuredDataType | Schema type (see supported types below) |
| data* | object | Type-specific data (varies by type) |
Supported Types
Article
typescript
import { generateLD } from 'indxel'
const ld = generateLD('Article', {
headline: 'How to Fix SEO in Next.js',
datePublished: '2026-01-15',
dateModified: '2026-01-20',
author: { name: 'Jane Doe', url: 'https://jane.dev' },
image: '/og-article.png',
wordCount: 1200,
tags: ['seo', 'nextjs'],
})FAQ
typescript
const ld = generateLD('FAQ', {
questions: [
{ question: 'What is Indxel?', answer: 'ESLint for SEO.' },
{ question: 'Is it free?', answer: 'Yes. The CLI and SDK are MIT-licensed.' },
],
})HowTo
typescript
const ld = generateLD('HowTo', {
name: 'Add SEO validation to Next.js',
description: 'Set up Indxel in 30 seconds.',
totalTime: 'PT2M',
steps: [
{ name: 'Install', text: 'Run npm install indxel' },
{ name: 'Configure', text: 'Run npx indxel-cli init' },
{ name: 'Validate', text: 'Run npx indxel-cli check' },
],
})Product
typescript
const ld = generateLD('Product', {
name: 'Indxel Plus',
description: 'SEO monitoring dashboard with auto-indexation.',
image: '/og-plus.png',
offers: {
price: 19,
priceCurrency: 'EUR',
availability: 'https://schema.org/InStock',
},
})Breadcrumb
typescript
const ld = generateLD('Breadcrumb', {
items: [
{ name: 'Home', url: 'https://indxel.com' },
{ name: 'Docs', url: 'https://indxel.com/docs' },
{ name: 'SDK', url: 'https://indxel.com/docs/sdk' },
],
})Organization
typescript
const ld = generateLD('Organization', {
name: 'My SaaS Inc.',
url: 'https://mysaas.com',
logo: 'https://mysaas.com/logo.png',
sameAs: ['https://github.com/mysaas', 'https://twitter.com/mysaas'],
})WebPage
typescript
const ld = generateLD('WebPage', {
name: 'Pricing',
description: 'Simple pricing for developers.',
url: 'https://mysaas.com/pricing',
})SoftwareApplication
typescript
const ld = generateLD('SoftwareApplication', {
name: 'Indxel',
description: 'Developer-first SEO infrastructure.',
applicationCategory: 'DeveloperApplication',
operatingSystem: 'Cross-platform',
offers: { price: 0, priceCurrency: 'USD' },
})WebSite
typescript
const ld = generateLD('WebSite', {
name: 'Indxel',
url: 'https://indxel.com',
description: 'Developer-first SEO infrastructure.',
})Usage in JSX
In a Next.js pagetsx
import { generateLD } from 'indxel'
const faqLd = generateLD('FAQ', {
questions: [
{ question: 'What is Indxel?', answer: 'ESLint for SEO.' },
],
})
export default function Page() {
return (
<>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(faqLd) }}
/>
{/* page content */}
</>
)
}Multiple schemas per page
You can include multiple JSON-LD blocks on a single page. Google recommends using separate script tags for each schema.