Package Exports
- @markangeloujamandre/schema
- @markangeloujamandre/schema/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@markangeloujamandre/schema) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Schema Generator AI
AI-powered Schema.org JSON-LD generator using Google Gemini for automatic SEO markup generation.
Installation
npm install @yourusername/schema-generator-aiUsage
Basic Usage
import {
generateSchemaFile,
getSchemaUrl,
} from "@yourusername/schema-generator-ai";
// Generate schema for a page
const schemaUrl = await generateSchemaFile(page, blocks, route);
// Get public URL for existing schema
const url = getSchemaUrl("/rooms/deluxe-room");Environment Setup
Set your Gemini API key:
GEMINI_API_KEY=your_api_key_hereAPI
generateSchemaFile(page, blocks, route)
Generates Schema.org JSON-LD markup for a page.
Parameters:
page(Object): Page data containing content, metadata, and taxonomyblocks(Array): Optional array of content blocksroute(String): Page route (e.g., '/rooms/deluxe')
Returns: Promise
getSchemaUrl(route)
Gets the public URL for a schema file.
Parameters:
route(String): Page route
Returns: String - Schema file URL
getSchemaFilePath(route)
Gets the file system path for a schema file (server-side only).
Parameters:
route(String): Page route
Returns: String - File system path
Supported Schema Types
- Hotel/Resort
- HotelRoom/Accommodation
- Restaurant
- BlogPosting/Article
- Offer
- SportsActivityLocation
- HealthAndBeautyBusiness
Requirements
- Node.js >= 14.0.0
- Google Gemini API key
- Server-side environment (Next.js, Express, etc.)
License
MIT