Added meta to layouts
This commit is contained in:
@@ -3,12 +3,19 @@ import { Font } from 'astro:assets'
|
||||
|
||||
import '@/styles/global.css'
|
||||
|
||||
import { resolveImage } from '@/lib/images/resolve'
|
||||
|
||||
interface Props {
|
||||
title: string
|
||||
description?: string
|
||||
image?: string
|
||||
noindex?: boolean
|
||||
}
|
||||
|
||||
const { title, description } = Astro.props
|
||||
const { title, description, image, noindex } = Astro.props
|
||||
const canonical = new URL(Astro.url.pathname, Astro.site)
|
||||
const preview = image ? resolveImage(image) : undefined
|
||||
const previewUrl = preview ? new URL(preview.src, Astro.site) : undefined
|
||||
---
|
||||
|
||||
<!doctype html>
|
||||
@@ -20,6 +27,15 @@ const { title, description } = Astro.props
|
||||
|
||||
<title>{title}</title>
|
||||
{description && <meta name="description" content={description} />}
|
||||
{noindex && <meta name="robots" content="noindex" />}
|
||||
<link rel="canonical" href={canonical} />
|
||||
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content={title} />
|
||||
<meta property="og:url" content={canonical} />
|
||||
{description && <meta property="og:description" content={description} />}
|
||||
{previewUrl && <meta property="og:image" content={previewUrl} />}
|
||||
<meta name="twitter:card" content={previewUrl ? 'summary_large_image' : 'summary'} />
|
||||
|
||||
<Font cssVariable="--font-geist" preload />
|
||||
<Font cssVariable="--font-geist-mono" preload />
|
||||
|
||||
Reference in New Issue
Block a user