22interface Props {
33 title: string
44 description? : string
5+ image? : string | undefined
56 favicon? : string
67 faviconMimeType? : string
78 canonicalURL? : string | undefined
@@ -13,6 +14,7 @@ interface Props {
1314const {
1415 title,
1516 description,
17+ image = ' default-post-thumbnail.png' ,
1618 favicon,
1719 faviconMimeType,
1820 canonicalURL,
@@ -21,14 +23,14 @@ const {
2123 robots,
2224} = Astro .props
2325
24- const _canonicalURL = canonicalURL || Astro .url .href
26+ const url = canonicalURL || Astro .url .href
2527---
2628
2729<!-- Global Metadata -->
2830<meta charset =" utf-8" />
2931<meta name =" viewport" content =" width=device-width, initial-scale=1.0" />
3032<link rel =" icon" type ={ faviconMimeType } href ={ favicon } />
31- { _canonicalURL && <link rel = " canonical" href = { _canonicalURL } />}
33+ { url && <link rel = " canonical" href = { url } />}
3234
3335<!-- Primary Meta Tags -->
3436<title >{ title } </title >
@@ -40,3 +42,17 @@ const _canonicalURL = canonicalURL || Astro.url.href
4042<meta name =" author" content ={ author } />
4143{ robots && <meta name = " robots" content = { robots } />}
4244<meta name =" generator" content ={ Astro .generator } />
45+
46+ <!-- Open Graph / Facebook -->
47+ <meta property =" og:type" content =" website" />
48+ <meta property =" og:url" content ={ url } />
49+ <meta property =" og:title" content ={ title } />
50+ <meta property =" og:description" content ={ description } />
51+ <meta property =" og:image" content ={ new URL (image , Astro .site )} />
52+
53+ <!-- Twitter -->
54+ <meta property =" twitter:card" content =" summary_large_image" />
55+ <meta property =" twitter:url" content ={ url } />
56+ <meta property =" twitter:title" content ={ title } />
57+ <meta property =" twitter:description" content ={ description } />
58+ <meta property =" twitter:image" content ={ new URL (image , Astro .site )} />
0 commit comments