Add OG metadata (#110)
This commit is contained in:
parent
a6c95f4046
commit
47a23ca34a
2 changed files with 9 additions and 1 deletions
|
|
@ -12,6 +12,7 @@ import getObjectKeys from '@/utils/getObjectKeys';
|
||||||
import data from '../data';
|
import data from '../data';
|
||||||
|
|
||||||
const { seo, i18n, ...dataWithoutSeoAndI18n } = data;
|
const { seo, i18n, ...dataWithoutSeoAndI18n } = data;
|
||||||
|
const seoImage = seo.image ? seo.image : '/favicon.svg';
|
||||||
---
|
---
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
@ -19,10 +20,13 @@ const { seo, i18n, ...dataWithoutSeoAndI18n } = data;
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
||||||
<meta name="generator" content={Astro.generator} />
|
<meta name="generator" content={Astro.generator} />
|
||||||
<title>{seo.title}</title>
|
<title>{seo.title}</title>
|
||||||
<meta name="description" content={seo.description} />
|
<meta name="description" content={seo.description} />
|
||||||
|
<link rel="icon" type={seo.image ? 'image/jpeg' : 'image/svg+xml'} href={seoImage} />
|
||||||
|
<meta property="og:title" content={seo.title} />
|
||||||
|
<meta property="og:description" content={seo.description} />
|
||||||
|
<meta property="og:image" content={seoImage} />
|
||||||
</head>
|
</head>
|
||||||
<body class="flex justify-center bg-gray-50">
|
<body class="flex justify-center bg-gray-50">
|
||||||
<div class="flex relative transform-none gap-8 w-full max-w-5xl px-2 py-3 sm:px-8 sm:py-12 lg:py-20">
|
<div class="flex relative transform-none gap-8 w-full max-w-5xl px-2 py-3 sm:px-8 sm:py-12 lg:py-20">
|
||||||
|
|
|
||||||
|
|
@ -8,4 +8,8 @@ export interface Seo {
|
||||||
* Description that will be displayed in Google search results. To be fully visible in search results, it should be no longer than 160 characters.
|
* Description that will be displayed in Google search results. To be fully visible in search results, it should be no longer than 160 characters.
|
||||||
*/
|
*/
|
||||||
description: string;
|
description: string;
|
||||||
|
/**
|
||||||
|
* Path to the image inside the public folder that will be used as page icon and as a preview image in site links.
|
||||||
|
*/
|
||||||
|
image?: string;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue