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
structuredDatasince 1.0.0export default function structuredData(options?: StructuredDataOptions): AstroIntegrationRegisters 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
optionsStructuredDataOptions- See Integration options. Validated immediately; invalid options throw.
validateRecommended
validateRecommendedsince 1.3.0function 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
typeSchemaType- schema.org @type name, e.g. "Organization" or "BlogPosting".
dataRecord<string, unknown>- The props or schema object to check.
calculateReadingTime
calculateReadingTimesince 1.3.0function calculateReadingTime(text: string, wordsPerMinute?: number): {
wordCount: number;
readingTimeMinutes: number;
timeRequired: string;
}timeRequired is an ISO 8601 duration such as PT4M.
Parameters
textstring- Plain text or HTML.
wordsPerMinutenumber- Reading speed. Default 200.