Skip to content

Commit e83fd4f

Browse files
authored
feat: enhance structured data with BreadcrumbList and Service schema for improved SEO
1 parent 8a8f6b9 commit e83fd4f

2 files changed

Lines changed: 55 additions & 55 deletions

File tree

public/_redirects

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/layouts/ServiceLayout.astro

Lines changed: 55 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -177,36 +177,62 @@ const finalKeywords =
177177
keywords.length > 0 ? keywords.join(", ") : defaultKeywords;
178178
const { gaMeasurementId, shouldLoadAnalytics } = getAnalyticsConfig();
179179
180-
// Build structured data with Service schema and optional FAQPage
181-
const structuredData = {
182-
"@context": "https://schema.org",
183-
"@graph": [
180+
const serviceUrl = new URL(Astro.url.pathname, siteUrl).toString();
181+
182+
const breadcrumbSchema = {
183+
"@type": "BreadcrumbList",
184+
"@id": `${serviceUrl}#breadcrumb`,
185+
itemListElement: [
186+
{
187+
"@type": "ListItem",
188+
position: 1,
189+
name: "Home",
190+
item: siteUrl,
191+
},
184192
{
185-
"@type": "Service",
186-
"@id": `${canonicalUrl}#service`,
193+
"@type": "ListItem",
194+
position: 2,
195+
name: "Services",
196+
item: `${siteUrl}/services/`,
197+
},
198+
{
199+
"@type": "ListItem",
200+
position: 3,
187201
name: serviceName,
188-
description: serviceDescription,
189-
datePublished: publishedTime,
190-
dateModified: modifiedTime,
191-
provider: {
192-
"@id": `${siteUrl}/#person`,
193-
},
194-
areaServed: [
195-
{
196-
"@type": "Country",
197-
name: "United States",
198-
},
199-
{
200-
"@type": "City",
201-
name: "Miami",
202-
containedInPlace: {
203-
"@type": "State",
204-
name: "Florida",
205-
},
206-
},
207-
],
208-
url: canonicalUrl,
202+
item: serviceUrl,
209203
},
204+
],
205+
};
206+
207+
const serviceOfferingSchema = {
208+
"@type": ["Service", "Offer"],
209+
"@id": `${serviceUrl}#service`,
210+
name: serviceName,
211+
description: serviceDescription,
212+
url: serviceUrl,
213+
provider: {
214+
"@type": "Person",
215+
"@id": `${siteUrl}/#person`,
216+
name: "Avaab Razzaq",
217+
url: siteUrl,
218+
},
219+
areaServed: {
220+
"@type": "Place",
221+
name: "United States",
222+
},
223+
serviceType: serviceName,
224+
availableChannel: {
225+
"@type": "ServiceChannel",
226+
serviceUrl: `${siteUrl}/contact/`,
227+
servicePhone: "",
228+
availableLanguage: "English",
229+
},
230+
};
231+
232+
// Build structured data with optional FAQPage
233+
const structuredData = {
234+
"@context": "https://schema.org",
235+
"@graph": [
210236
{
211237
"@type": "WebPage",
212238
"@id": canonicalUrl,
@@ -226,30 +252,6 @@ const structuredData = {
226252
cssSelector: ["h1", ".hero-subheadline", ".service-intro"],
227253
},
228254
},
229-
{
230-
"@type": "BreadcrumbList",
231-
"@id": `${canonicalUrl}#breadcrumb`,
232-
itemListElement: [
233-
{
234-
"@type": "ListItem",
235-
position: 1,
236-
name: "Home",
237-
item: `${siteUrl}/`,
238-
},
239-
{
240-
"@type": "ListItem",
241-
position: 2,
242-
name: "Services",
243-
item: `${siteUrl}/services/`,
244-
},
245-
{
246-
"@type": "ListItem",
247-
position: 3,
248-
name: serviceName,
249-
item: canonicalUrl,
250-
},
251-
],
252-
},
253255
...(normalizedFaqs.length > 0
254256
? [
255257
{
@@ -265,6 +267,8 @@ const structuredData = {
265267
},
266268
]
267269
: []),
270+
breadcrumbSchema,
271+
serviceOfferingSchema,
268272
],
269273
};
270274
---

0 commit comments

Comments
 (0)