feat: comprehensive SEO system with keywords and schema markup
- Add 4-locale keyword configurations (SR, EN, DE, FR) - Create schema generators (Product, Organization, Breadcrumb) - Add React components for JSON-LD rendering - Implement caching for keyword performance - Abstract all SEO logic for maintainability
This commit is contained in:
39
src/components/seo/JsonLd.tsx
Normal file
39
src/components/seo/JsonLd.tsx
Normal file
@@ -0,0 +1,39 @@
|
||||
import Script from 'next/script';
|
||||
import { SchemaType } from '@/lib/seo/schema/types';
|
||||
|
||||
interface JsonLdProps {
|
||||
data: SchemaType | SchemaType[];
|
||||
}
|
||||
|
||||
/**
|
||||
* React component to render JSON-LD schema markup
|
||||
* Uses Next.js Script component for proper loading
|
||||
*
|
||||
* @param data - Single schema object or array of schemas
|
||||
* @returns Script component with JSON-LD
|
||||
* @example
|
||||
* <JsonLd data={productSchema} />
|
||||
* <JsonLd data={[productSchema, breadcrumbSchema]} />
|
||||
*/
|
||||
export function JsonLd({ data }: JsonLdProps) {
|
||||
// Handle single schema or array
|
||||
const schemas = Array.isArray(data) ? data : [data];
|
||||
|
||||
return (
|
||||
<>
|
||||
{schemas.map((schema, index) => (
|
||||
<Script
|
||||
key={index}
|
||||
id={`json-ld-${index}`}
|
||||
type="application/ld+json"
|
||||
strategy="afterInteractive"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: JSON.stringify(schema),
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default JsonLd;
|
||||
Reference in New Issue
Block a user