astro-structured-datav2.0.1

Package exports

The four entry points of the package and the functions they export.

Entry point Contents
@casoon/astro-structured-data The integration (default export) and the StructuredDataOptions type
@casoon/astro-structured-data/components The Astro components
@casoon/astro-structured-data/zod Zod schemas, prop types, validateRecommended
@casoon/astro-structured-data/utils calculateReadingTime

structuredData

functionstructuredDatasince 1.0.0
export default function structuredData(options?: StructuredDataOptions): AstroIntegration

Registers the configuration the components read, the middleware for meta tags and graph mode, the Dev Toolbar panel, and the post-build JSON-LD check.

Parameters

options
StructuredDataOptions
See Integration options. Validated immediately; invalid options throw.

validateRecommended

functionvalidateRecommendedsince 1.3.0
function validateRecommended(type: SchemaType, data: Record<string, unknown>): RecommendedWarning[]

Returns one { field, message } entry per missing recommended field. The build-time warning uses the same declaration.

Parameters

type
SchemaType
schema.org @type name, e.g. "Organization" or "BlogPosting".
data
Record<string, unknown>
The props or schema object to check.

calculateReadingTime

functioncalculateReadingTimesince 1.3.0
function calculateReadingTime(text: string, wordsPerMinute?: number): {
wordCount: number;
readingTimeMinutes: number;
timeRequired: string;
}

timeRequired is an ISO 8601 duration such as PT4M.

Parameters

text
string
Plain text or HTML.
wordsPerMinute
number
Reading speed. Default 200.

Edit this page on GitHub · Docs for v2.0.1