---
import '../styles/global.css';

import { siteMetadata } from '@/lib/site';

interface Props {
    canonicalUrl?: string;
    description?: string;
    openGraphDescription?: string;
    openGraphTitle?: string;
    robots?: string;
    title?: string;
}

const {
    canonicalUrl,
    description = siteMetadata.siteDescription,
    robots = 'index,follow',
    title = `${siteMetadata.siteName} | ${siteMetadata.siteTagline}`,
} = Astro.props;

const openGraphTitle = Astro.props.openGraphTitle ?? title;
const openGraphDescription = Astro.props.openGraphDescription ?? description;
---

<!doctype html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="description" content={description} />
        <meta name="robots" content={robots} />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <meta name="generator" content={Astro.generator} />
        <meta property="og:site_name" content={siteMetadata.siteName} />
        <meta property="og:title" content={openGraphTitle} />
        <meta property="og:description" content={openGraphDescription} />
        <meta property="og:type" content="website" />
        {canonicalUrl && <meta property="og:url" content={canonicalUrl} />}
        <meta name="twitter:card" content="summary_large_image" />
        <meta name="twitter:title" content={openGraphTitle} />
        <meta name="twitter:description" content={openGraphDescription} />
        {canonicalUrl && <link rel="canonical" href={canonicalUrl} />}
        <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
        <link rel="preconnect" href="https://fonts.googleapis.com" />
        <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
        <link
            href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
            rel="stylesheet"
        />
        <title>{title}</title>
    </head>
    <body>
        <a class="skip-link" href="#content">Skip to content</a>
        <slot />
    </body>
</html>
