QR-master/src/lib/schema.ts

246 lines
6.6 KiB
TypeScript

export interface BreadcrumbItem {
name: string;
url: string;
}
export interface BlogPost {
title: string;
description: string;
slug: string;
author: string;
authorUrl: string;
datePublished: string;
dateModified: string;
image: string;
}
export interface FAQItem {
question: string;
answer: string;
}
export interface ProductOffer {
name: string;
price: string;
priceCurrency: string;
availability: string;
url: string;
}
export interface HowToStep {
name: string;
text: string;
url?: string;
}
export interface HowToTask {
name: string;
description: string;
steps: HowToStep[];
totalTime?: string;
}
export function organizationSchema() {
return {
'@context': 'https://schema.org',
'@type': 'Organization',
'@id': 'https://www.qrmaster.net/#organization',
name: 'QR Master',
alternateName: 'QRMaster',
url: 'https://www.qrmaster.net',
logo: {
'@type': 'ImageObject',
url: 'https://www.qrmaster.net/static/og-image.png',
width: 1200,
height: 630,
},
image: 'https://www.qrmaster.net/static/og-image.png',
sameAs: [
'https://twitter.com/qrmaster',
],
contactPoint: {
'@type': 'ContactPoint',
contactType: 'Customer Support',
email: 'support@qrmaster.net',
availableLanguage: ['English', 'German'],
},
description: 'B2B SaaS platform for dynamic QR code generation with analytics, branding, and bulk generation for enterprise marketing campaigns.',
slogan: 'Dynamic QR codes that work smarter',
foundingDate: '2025',
areaServed: 'Worldwide',
serviceType: 'Software as a Service',
priceRange: '$0 - $29',
knowsAbout: [
'QR Code Generation',
'Marketing Analytics',
'Campaign Tracking',
'Dynamic QR Codes',
'Bulk QR Generation',
],
hasOfferCatalog: {
'@type': 'OfferCatalog',
name: 'QR Master Plans',
itemListElement: [
{
'@type': 'Offer',
itemOffered: {
'@type': 'SoftwareApplication',
name: 'QR Master Free',
applicationCategory: 'BusinessApplication',
operatingSystem: 'Web Browser',
},
},
{
'@type': 'Offer',
itemOffered: {
'@type': 'SoftwareApplication',
name: 'QR Master Pro',
applicationCategory: 'BusinessApplication',
operatingSystem: 'Web Browser',
},
},
],
},
inLanguage: 'en',
mainEntityOfPage: 'https://www.qrmaster.net',
};
}
export function websiteSchema() {
return {
'@context': 'https://schema.org',
'@type': 'WebSite',
'@id': 'https://www.qrmaster.net/#website',
name: 'QR Master',
url: 'https://www.qrmaster.net',
inLanguage: 'en',
mainEntityOfPage: 'https://www.qrmaster.net',
publisher: {
'@id': 'https://www.qrmaster.net/#organization',
},
potentialAction: {
'@type': 'SearchAction',
target: {
'@type': 'EntryPoint',
urlTemplate: 'https://www.qrmaster.net/blog?q={search_term_string}',
},
'query-input': 'required name=search_term_string',
},
};
}
export function breadcrumbSchema(items: BreadcrumbItem[]) {
return {
'@context': 'https://schema.org',
'@type': 'BreadcrumbList',
'@id': `https://www.qrmaster.net${items[items.length - 1]?.url}#breadcrumb`,
inLanguage: 'en',
mainEntityOfPage: `https://www.qrmaster.net${items[items.length - 1]?.url}`,
itemListElement: items.map((item, index) => ({
'@type': 'ListItem',
position: index + 1,
name: item.name,
item: `https://www.qrmaster.net${item.url}`,
})),
};
}
export function blogPostingSchema(post: BlogPost) {
return {
'@context': 'https://schema.org',
'@type': 'BlogPosting',
'@id': `https://www.qrmaster.net/blog/${post.slug}#article`,
headline: post.title,
description: post.description,
image: post.image,
datePublished: post.datePublished,
dateModified: post.dateModified,
inLanguage: 'en',
mainEntityOfPage: `https://www.qrmaster.net/blog/${post.slug}`,
author: {
'@type': 'Person',
name: post.author,
url: post.authorUrl,
},
publisher: {
'@type': 'Organization',
name: 'QR Master',
url: 'https://www.qrmaster.net',
logo: {
'@type': 'ImageObject',
url: 'https://www.qrmaster.net/static/og-image.png',
width: 1200,
height: 630,
},
},
isPartOf: {
'@type': 'Blog',
'@id': 'https://www.qrmaster.net/blog#blog',
name: 'QR Master Blog',
url: 'https://www.qrmaster.net/blog',
},
};
}
export function faqPageSchema(faqs: FAQItem[]) {
return {
'@context': 'https://schema.org',
'@type': 'FAQPage',
'@id': 'https://www.qrmaster.net/faq#faqpage',
inLanguage: 'en',
mainEntityOfPage: 'https://www.qrmaster.net/faq',
mainEntity: faqs.map((faq) => ({
'@type': 'Question',
name: faq.question,
acceptedAnswer: {
'@type': 'Answer',
text: faq.answer,
},
})),
};
}
export function productSchema(product: { name: string; description: string; offers: ProductOffer[] }) {
return {
'@context': 'https://schema.org',
'@type': 'Product',
'@id': 'https://www.qrmaster.net/pricing#product',
name: product.name,
description: product.description,
inLanguage: 'en',
mainEntityOfPage: 'https://www.qrmaster.net/pricing',
brand: {
'@type': 'Organization',
name: 'QR Master',
},
offers: product.offers.map((offer) => ({
'@type': 'Offer',
name: offer.name,
price: offer.price,
priceCurrency: offer.priceCurrency,
availability: offer.availability,
url: offer.url,
})),
};
}
export function howToSchema(task: HowToTask) {
return {
'@context': 'https://schema.org',
'@type': 'HowTo',
'@id': `https://www.qrmaster.net/blog/${task.name.toLowerCase().replace(/\s+/g, '-')}#howto`,
name: task.name,
description: task.description,
inLanguage: 'en',
mainEntityOfPage: `https://www.qrmaster.net/blog/${task.name.toLowerCase().replace(/\s+/g, '-')}`,
totalTime: task.totalTime || 'PT5M',
step: task.steps.map((step, index) => ({
'@type': 'HowToStep',
position: index + 1,
name: step.name,
text: step.text,
url: step.url,
})),
};
}