feat(seo): implement AI SEO and structured data schema
All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 49s
Build & Deploy / 🧪 QA (push) Successful in 2m27s
CI - Lint, Typecheck & Test / quality-assurance (pull_request) Successful in 3m28s
Build & Deploy / 🏗️ Build (push) Successful in 3m13s
Build & Deploy / 🚀 Deploy (push) Successful in 47s
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 1s
All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 49s
Build & Deploy / 🧪 QA (push) Successful in 2m27s
CI - Lint, Typecheck & Test / quality-assurance (pull_request) Successful in 3m28s
Build & Deploy / 🏗️ Build (push) Successful in 3m13s
Build & Deploy / 🚀 Deploy (push) Successful in 47s
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 1s
- Add robust JSON-LD schema generators (LocalBusiness, FAQ, Service, Event) - Refactor JsonLd component to use @graph pattern for merging global/local schemas - Create FaqBlock component with automatic FAQPage schema injection - Inject specific JSON-LD schemas into mdx pages (home, kompetenzen, messen) - Add structured AI SEO content (hard facts, stats, clear definitions)
This commit is contained in:
@@ -1,53 +1,67 @@
|
||||
import { Thing, WithContext } from 'schema-dts';
|
||||
import { Thing, WithContext, Graph } from 'schema-dts';
|
||||
import { getOrganizationSchema, getLocalBusinessSchema, SITE_URL } from '@/lib/schema';
|
||||
|
||||
interface JsonLdProps {
|
||||
id?: string;
|
||||
data?: WithContext<Thing> | WithContext<Thing>[];
|
||||
disableGlobal?: boolean;
|
||||
}
|
||||
|
||||
export default function JsonLd({ id, data }: JsonLdProps) {
|
||||
// If data is provided, use it. Otherwise, use the default Organization + WebSite schema.
|
||||
const schemaData = data || [
|
||||
{
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'Organization',
|
||||
name: 'E-TIB GmbH',
|
||||
url: 'https://e-tib.com',
|
||||
logo: 'https://e-tib.com/assets/logo.png',
|
||||
sameAs: [
|
||||
'https://www.instagram.com/me.and.eloise/',
|
||||
],
|
||||
description: 'Ihr Partner für Kabelleitungstiefbau, Horizontalspülbohrungen, Planung und Vermessung.',
|
||||
address: {
|
||||
'@type': 'PostalAddress',
|
||||
streetAddress: 'Gewerbestraße 22',
|
||||
addressLocality: 'Guben',
|
||||
postalCode: '03172',
|
||||
addressCountry: 'DE',
|
||||
},
|
||||
},
|
||||
{
|
||||
export default function JsonLd({ id, data, disableGlobal = false }: JsonLdProps) {
|
||||
let finalSchema: any;
|
||||
|
||||
if (disableGlobal && data) {
|
||||
// Escape hatch for overriding the global graph
|
||||
finalSchema = data;
|
||||
} else {
|
||||
// Construct the @graph array
|
||||
const graphItems: any[] = [];
|
||||
|
||||
// Always include Organization, WebSite, and LocalBusiness for strong AI SEO presence
|
||||
graphItems.push(getOrganizationSchema());
|
||||
graphItems.push({
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'WebSite',
|
||||
name: 'E-TIB',
|
||||
url: 'https://e-tib.com',
|
||||
url: SITE_URL,
|
||||
potentialAction: {
|
||||
'@type': 'SearchAction',
|
||||
target: {
|
||||
'@type': 'EntryPoint',
|
||||
urlTemplate: 'https://e-tib.com/search?q={search_term_string}',
|
||||
urlTemplate: `${SITE_URL}/search?q={search_term_string}`,
|
||||
},
|
||||
'query-input': 'required name=search_term_string',
|
||||
},
|
||||
});
|
||||
graphItems.push(getLocalBusinessSchema());
|
||||
|
||||
// Append dynamic data from props
|
||||
if (data) {
|
||||
if (Array.isArray(data)) {
|
||||
// Strip out their individual @context if we are pushing to a graph
|
||||
const cleanedData = data.map((d: any) => {
|
||||
const { '@context': _, ...rest } = d;
|
||||
return rest;
|
||||
});
|
||||
graphItems.push(...cleanedData);
|
||||
} else {
|
||||
const { '@context': _, ...rest } = data as any;
|
||||
graphItems.push(rest);
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
finalSchema = {
|
||||
'@context': 'https://schema.org',
|
||||
'@graph': graphItems,
|
||||
};
|
||||
}
|
||||
|
||||
return (
|
||||
<script
|
||||
id={id}
|
||||
type="application/ld+json"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: JSON.stringify(schemaData),
|
||||
__html: JSON.stringify(finalSchema),
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user