Files
CompanySite/src/components/SEO.astro
T
Clintchiz 0614ae6f85
E2E Test Suite / Critical User Journeys (push) Has been skipped
E2E Test Suite / API Integration Tests (push) Has been skipped
Deploy to Production / Build & Verify (push) Failing after 13s
Ping Search Engines / Notify Search Engines (push) Successful in 3s
Deploy to Production / Pre-Deploy Tests (push) Has been skipped
Deploy to Production / Deploy to Railway (push) Has been skipped
Deploy to Production / Deploy to Render (push) Has been skipped
Deploy to Production / Deploy to VPS (PM2) (push) Has been skipped
Deploy to Production / Deploy to Fly.io (push) Has been skipped
Deploy to Production / Post-Deploy Verification (push) Has been skipped
Deploy to Production / Notify on Failure (push) Successful in 1s
E2E Test Suite / Smoke Tests (P0) (push) Failing after 9m36s
E2E Test Suite / Form Interaction Tests (push) Failing after 12m6s
E2E Test Suite / Destructive & Chaos Tests (push) Failing after 11m46s
E2E Test Suite / Cross-Browser Regression (chromium) (push) Failing after 9m31s
E2E Test Suite / Cross-Browser Regression (firefox) (push) Failing after 11m5s
E2E Test Suite / Cross-Browser Regression (webkit) (push) Failing after 15m24s
E2E Test Suite / Security Header Tests (push) Failing after 7m55s
E2E Test Suite / Test Report Summary (push) Failing after 6s
E2E Test Suite / Mobile Device Tests (push) Failing after 3h12m28s
Uptime Monitor / Health & Response Time (push) Successful in 5s
Uptime Monitor / SSL Certificate (push) Successful in 3s
Uptime Monitor / Send Alerts (push) Has been skipped
Uptime Monitor / Record Uptime Success (push) Successful in 2s
Latest Updated Pages
2026-03-22 14:37:17 +05:30

244 lines
6.4 KiB
Plaintext

---
// SEO Component for page-specific structured data
// Use in the head slot of BaseLayout for additional schema markup
interface BreadcrumbItem {
name: string;
url: string;
}
interface Props {
type?: 'WebPage' | 'BlogPosting' | 'Article' | 'Service' | 'AboutPage' | 'ContactPage' | 'FAQPage';
breadcrumbs?: BreadcrumbItem[];
article?: {
author: string;
datePublished: string;
dateModified?: string;
category?: string;
tags?: string[];
image?: string;
wordCount?: number;
};
service?: {
name: string;
description: string;
};
faq?: Array<{
question: string;
answer: string;
}>;
}
const { type = 'WebPage', breadcrumbs, article, service, faq } = Astro.props;
const baseUrl = 'https://workroot.in';
const currentUrl = Astro.url.href;
// Get page title and description from parent layout props
const pageTitle = (Astro.props as any).title || 'WorkRoot IT Solutions';
const pageDescription = (Astro.props as any).description || 'Professional IT services including web development, cloud solutions, and digital transformation for businesses.';
// Generate BreadcrumbList schema
const breadcrumbSchema = breadcrumbs ? {
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": breadcrumbs.map((item, index) => ({
"@type": "ListItem",
"position": index + 1,
"name": item.name,
"item": `${baseUrl}${item.url}`
}))
} : null;
// Generate BlogPosting schema for blog posts (more specific than Article)
const blogPostingSchema = article && type === 'BlogPosting' ? {
"@context": "https://schema.org",
"@type": "BlogPosting",
"headline": pageTitle,
"description": pageDescription,
"image": article.image ? {
"@type": "ImageObject",
"url": article.image,
"width": 1200,
"height": 675
} : undefined,
"author": {
"@type": "Person",
"name": article.author,
"url": `${baseUrl}/about`
},
"datePublished": article.datePublished,
"dateModified": article.dateModified || article.datePublished,
"publisher": {
"@type": "Organization",
"name": "WorkRoot IT Solutions",
"url": baseUrl,
"logo": {
"@type": "ImageObject",
"url": `${baseUrl}/logo.png`,
"width": 512,
"height": 512
}
},
"mainEntityOfPage": {
"@type": "WebPage",
"@id": currentUrl
},
"keywords": article.tags?.join(', '),
"articleSection": article.category,
"wordCount": article.wordCount,
"inLanguage": "en-US"
} : null;
// Generate Service schema
const serviceSchema = service ? {
"@context": "https://schema.org",
"@type": "Service",
"name": service.name,
"description": service.description,
"provider": {
"@type": "Organization",
"name": "WorkRoot IT Solutions",
"url": baseUrl
},
"areaServed": "Worldwide",
"serviceType": service.name
} : null;
// Generate WebPage schema for standard pages
const webPageSchema = type === 'WebPage' && Astro.url.pathname !== '/' ? {
"@context": "https://schema.org",
"@type": "WebPage",
"name": pageTitle,
"description": pageDescription,
"url": currentUrl,
"inLanguage": "en-US",
"isPartOf": {
"@type": "WebSite",
"@id": `${baseUrl}/#website`
},
"about": {
"@type": "Organization",
"name": "WorkRoot IT Solutions"
},
"primaryImageOfPage": {
"@type": "ImageObject",
"url": `${baseUrl}/og-image.jpg`
}
} : null;
// Generate FAQPage schema
const faqPageSchema = faq && faq.length > 0 ? {
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": faq.map((item) => ({
"@type": "Question",
"name": item.question,
"acceptedAnswer": {
"@type": "Answer",
"text": item.answer
}
}))
} : null;
// Generate AboutPage schema
const aboutPageSchema = type === 'AboutPage' ? {
"@context": "https://schema.org",
"@type": "AboutPage",
"name": pageTitle,
"description": pageDescription,
"url": currentUrl,
"inLanguage": "en-US",
"mainEntity": {
"@type": "Organization",
"name": "WorkRoot IT Solutions",
"url": baseUrl
}
} : null;
// Generate ContactPage schema with LocalBusiness details
const contactPageSchema = type === 'ContactPage' ? {
"@context": "https://schema.org",
"@type": "ContactPage",
"name": pageTitle,
"description": pageDescription,
"url": currentUrl,
"inLanguage": "en-US",
"mainEntity": {
"@type": "LocalBusiness",
"name": "WorkRoot IT Solutions",
"alternateName": "WorkRoot IT Solutions LLP",
"url": baseUrl,
"telephone": "+91-9561417403",
"email": "admin@workroot.in",
"address": {
"@type": "PostalAddress",
"streetAddress": "At Post Rajapur Shantinagar, Taluka Khatav",
"addressLocality": "Satara",
"addressRegion": "MH",
"postalCode": "415503",
"addressCountry": "IN"
},
"geo": {
"@type": "GeoCoordinates",
"latitude": "17.7733632",
"longitude": "74.3309312"
},
"openingHoursSpecification": [
{
"@type": "OpeningHoursSpecification",
"dayOfWeek": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"],
"opens": "09:00",
"closes": "18:00"
}
],
"priceRange": "$$",
"currenciesAccepted": "INR",
"paymentAccepted": "Cash, Credit Card, Bank Transfer",
"areaServed": "Worldwide",
"image": `${baseUrl}/og-image.jpg`,
"logo": {
"@type": "ImageObject",
"url": `${baseUrl}/logo.png`,
"width": 512,
"height": 512
},
"hasMap": "https://maps.google.com/?q=Rajapur+Shantinagar+Khatav+Satara+Maharashtra+415503",
"sameAs": [
"https://twitter.com/workroot",
"https://linkedin.com/company/workroot",
"https://github.com/workroot",
"https://facebook.com/workroot"
]
}
} : null;
---
{breadcrumbSchema && (
<script type="application/ld+json" set:html={JSON.stringify(breadcrumbSchema)} />
)}
{blogPostingSchema && (
<script type="application/ld+json" set:html={JSON.stringify(blogPostingSchema)} />
)}
{serviceSchema && (
<script type="application/ld+json" set:html={JSON.stringify(serviceSchema)} />
)}
{webPageSchema && (
<script type="application/ld+json" set:html={JSON.stringify(webPageSchema)} />
)}
{faqPageSchema && (
<script type="application/ld+json" set:html={JSON.stringify(faqPageSchema)} />
)}
{aboutPageSchema && (
<script type="application/ld+json" set:html={JSON.stringify(aboutPageSchema)} />
)}
{contactPageSchema && (
<script type="application/ld+json" set:html={JSON.stringify(contactPageSchema)} />
)}