@@ -35,6 +35,12 @@ type Props = {
3535const siteUrl = buildSiteUrl (Astro .site );
3636const currentYear = new Date ().getFullYear ();
3737
38+ const SERVICE_OG_MAP: Record <string , string > = {
39+ " ai-automation" : ` ${siteUrl }/og-service-ai.png ` ,
40+ " technical-seo" : ` ${siteUrl }/og-service-seo.png ` ,
41+ " full-stack-web-development" : ` ${siteUrl }/og-service-web.png ` ,
42+ };
43+
3844const {
3945 title,
4046 description,
@@ -45,21 +51,28 @@ const {
4551 serviceName,
4652 serviceDescription,
4753 keywords = [],
48- ogImage = new URL ( " /og-services.png " , siteUrl ). toString () ,
54+ ogImage,
4955 faqs = [],
5056 publishedTime,
5157 modifiedTime,
5258} = Astro .props as Props ;
5359
5460const canonicalUrl = normalizeCanonicalUrl (Astro .url .pathname , siteUrl );
55- const finalOgImage = ogImage .startsWith (" http" )
56- ? ogImage
57- : new URL (ogImage , siteUrl ).toString ();
5861
5962const currentServiceSlug = Astro .url .pathname
6063 .replace (/ ^ \/ services\/ / , " " )
6164 .replace (/ \/ $ / , " " );
6265
66+ const serviceSlug = currentServiceSlug ;
67+
68+ const finalOgImage =
69+ SERVICE_OG_MAP [serviceSlug ] ??
70+ (ogImage
71+ ? ogImage .startsWith (" http" )
72+ ? ogImage
73+ : new URL (ogImage , siteUrl ).toString ()
74+ : ` ${siteUrl }/og-ai-growth-engineer.png ` );
75+
6376const relatedServices = serviceCrossLinks
6477 .filter ((service ) => service .slug !== currentServiceSlug )
6578 .slice (0 , 3 );
0 commit comments