cleanup and cms migration
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
This commit is contained in:
98
src/components/seo-head.astro
Normal file
98
src/components/seo-head.astro
Normal file
@@ -0,0 +1,98 @@
|
||||
---
|
||||
import seoData from '../content/settings/seo.json';
|
||||
import general from '../content/settings/general.json';
|
||||
|
||||
interface Props {
|
||||
title?: string;
|
||||
description?: string;
|
||||
keywords?: string;
|
||||
ogImage?: string;
|
||||
canonical?: string;
|
||||
noindex?: boolean;
|
||||
pageType?: 'website' | 'article';
|
||||
}
|
||||
|
||||
const {
|
||||
title,
|
||||
description = seoData.defaultDescription,
|
||||
keywords = seoData.keywords,
|
||||
ogImage = seoData.ogImage,
|
||||
canonical,
|
||||
noindex = false,
|
||||
pageType = 'website',
|
||||
} = Astro.props;
|
||||
|
||||
const siteUrl = 'https://cachetdeco.com';
|
||||
const fullTitle = title
|
||||
? seoData.titleTemplate.replace('%s', title)
|
||||
: seoData.defaultTitle;
|
||||
|
||||
const canonicalUrl = canonical
|
||||
? `${siteUrl}${canonical}`
|
||||
: `${siteUrl}${Astro.url.pathname}`;
|
||||
|
||||
const ogImageUrl = ogImage
|
||||
? ogImage.startsWith('http') ? ogImage : `${siteUrl}${ogImage}`
|
||||
: `${siteUrl}/images/logo.png`;
|
||||
|
||||
// JSON-LD LocalBusiness structured data
|
||||
const structuredData = {
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'LocalBusiness',
|
||||
'@id': siteUrl,
|
||||
name: general.siteName,
|
||||
legalName: general.legalName,
|
||||
url: siteUrl,
|
||||
telephone: general.phone,
|
||||
email: general.email,
|
||||
address: {
|
||||
'@type': 'PostalAddress',
|
||||
addressLocality: 'Laval',
|
||||
addressRegion: 'QC',
|
||||
addressCountry: 'CA',
|
||||
},
|
||||
areaServed: general.serviceArea,
|
||||
description: seoData.defaultDescription,
|
||||
sameAs: [
|
||||
general.facebook,
|
||||
].filter(Boolean),
|
||||
image: ogImageUrl,
|
||||
priceRange: '$$',
|
||||
};
|
||||
---
|
||||
|
||||
<!-- Primary meta -->
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="generator" content={Astro.generator} />
|
||||
<title>{fullTitle}</title>
|
||||
<meta name="description" content={description} />
|
||||
{keywords && <meta name="keywords" content={keywords} />}
|
||||
{noindex && <meta name="robots" content="noindex, nofollow" />}
|
||||
<link rel="canonical" href={canonicalUrl} />
|
||||
|
||||
<!-- Open Graph -->
|
||||
<meta property="og:type" content={pageType} />
|
||||
<meta property="og:url" content={canonicalUrl} />
|
||||
<meta property="og:title" content={fullTitle} />
|
||||
<meta property="og:description" content={description} />
|
||||
<meta property="og:image" content={ogImageUrl} />
|
||||
<meta property="og:site_name" content={general.siteName} />
|
||||
<meta property="og:locale" content="fr_CA" />
|
||||
|
||||
<!-- Twitter Card -->
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:title" content={fullTitle} />
|
||||
<meta name="twitter:description" content={description} />
|
||||
<meta name="twitter:image" content={ogImageUrl} />
|
||||
|
||||
<!-- hreflang — French only for now; add en here when English pages exist -->
|
||||
<link rel="alternate" hreflang="fr" href={canonicalUrl} />
|
||||
<link rel="alternate" hreflang="x-default" href={canonicalUrl} />
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<link rel="icon" type="image/png" href="/images/logo.png" />
|
||||
|
||||
<!-- JSON-LD -->
|
||||
<script type="application/ld+json" set:html={JSON.stringify(structuredData)} />
|
||||
Reference in New Issue
Block a user