Skip to main content

Structured Data (JSON-LD)

import {
generateBlogPostingLD,
generateTechArticleLD,
generateCreativeWorkLD,
generatePageLD,
generateBreadcrumbLD,
generateWebSiteLD,
generateCollectionPageLD,
} from "@noxion/adapter-nextjs";

These functions generate JSON-LD structured data following schema.org vocabulary.


generatePageLD()

Automatically selects the correct JSON-LD type based on page.pageType. This is the recommended function for most use cases.

Signature

function generatePageLD(
page: NoxionPage,
config: NoxionConfig,
registry?: PageTypeRegistry
): Record<string, unknown>

Behavior

page.pageTypeGenerated @typeFunction used
"blog"BlogPostinggenerateBlogPostingLD()
"docs"TechArticlegenerateTechArticleLD()
"portfolio"CreativeWorkgenerateCreativeWorkLD()
OtherBlogPosting (default fallback)generateBlogPostingLD()

Usage

import { generatePageLD, generateBreadcrumbLD } from "@noxion/adapter-nextjs";

export default async function PageDetail({ params }) {
const page = await getPageBySlug((await params).slug);
const pageLd = generatePageLD(page, siteConfig);
const breadcrumbLd = generateBreadcrumbLD(page, siteConfig);

return (
<article>
<script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(pageLd) }} />
<script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(breadcrumbLd) }} />
{/* page content */}
</article>
);
}

generateBlogPostingLD()

Generates a BlogPosting schema for blog posts.

Signature

function generateBlogPostingLD(
page: NoxionPage,
config: NoxionConfig
): Record<string, unknown>

Generated schema

{
"@context": "https://schema.org",
"@type": "BlogPosting",
"headline": "Post Title",
"description": "Post description...",
"datePublished": "2025-02-01",
"dateModified": "2025-02-10T12:34:56.789Z",
"author": { "@type": "Person", "name": "Jane Doe" },
"publisher": { "@type": "Organization", "name": "My Blog", "url": "https://myblog.com" },
"image": { "@type": "ImageObject", "url": "...", "width": 1200, "height": 630 },
"keywords": "react, typescript",
"articleSection": "Web Dev",
"inLanguage": "en",
"url": "https://myblog.com/my-post"
}

generateTechArticleLD()

Generates a TechArticle schema for documentation pages.

Signature

function generateTechArticleLD(
page: NoxionPage,
config: NoxionConfig
): Record<string, unknown>

Generated schema

{
"@context": "https://schema.org",
"@type": "TechArticle",
"headline": "Configuration Guide",
"description": "How to configure Noxion...",
"dateModified": "2025-02-10T12:34:56.789Z",
"author": { "@type": "Person", "name": "Jane Doe" },
"publisher": { "@type": "Organization", "name": "My Docs" },
"inLanguage": "en",
"url": "https://mysite.com/docs/configuration"
}

generateCreativeWorkLD()

Generates a CreativeWork schema for portfolio projects. Uses metadata like technologies, projectUrl, and year when available.

Signature

function generateCreativeWorkLD(
page: NoxionPage,
config: NoxionConfig
): Record<string, unknown>

Generated schema

{
"@context": "https://schema.org",
"@type": "CreativeWork",
"name": "Noxion",
"description": "A Notion-powered website builder",
"author": { "@type": "Person", "name": "Jane Doe" },
"url": "https://nox.io",
"dateCreated": "2026",
"keywords": "TypeScript, React, Next.js"
}

generateBreadcrumbLD()

Generates a BreadcrumbList schema. If page.metadata.category exists, it is used as a middle breadcrumb item; otherwise the breadcrumb is Home -> Page.

Signature

function generateBreadcrumbLD(
page: NoxionPage,
config: NoxionConfig
): Record<string, unknown>

generateWebSiteLD()

Generates a WebSite schema with SearchAction.

function generateWebSiteLD(config: NoxionConfig): Record<string, unknown>

generateCollectionPageLD()

Generates a CollectionPage with an ItemList for homepage post listings.

function generateCollectionPageLD(
pages: NoxionPage[],
config: NoxionConfig
): Record<string, unknown>

Validating structured data

Use Google's Rich Results Test to validate your JSON-LD. Common requirements:

  • datePublished must be in ISO 8601 format
  • headline must be under 110 characters
  • Images must be at least 696px wide for summary_large_image Twitter Cards