---
import Favicon from "../../../assets/favicon.png";
import FaviconSvg from '../../../assets/favicon.svg';
import {getImage} from "astro:assets";
import {siteConfig} from "../../../config";

const appleTouchIcon = await getImage({
    src: Favicon,
    width: 180,
    height: 180,
    format: 'png'
})

interface Props {
    title: string;
    description: string;
    author?: string;
    ogImage?: string;
}

const { title, author,description, ogImage = "" } = Astro.props

const canonicalURL = new URL(Astro.url.pathname, Astro.site);
---
<meta name="title" content={title} />
{author && <meta name="author" content={author} />}
<meta name="description" content={description} />
{/* RSS */}
<link
        rel="alternate"
        type="application/rss+xml"
        title={`${siteConfig.title}/feed`}
        href={new URL("rss.xml", Astro.site)}
/>
{/* PWA */}
<link rel="icon" href="/favicon.ico" sizes="32x32" />
<link rel="icon" href={FaviconSvg.src} type="image/svg+xml" />
<link rel="apple-touch-icon" href={appleTouchIcon.src} />
<link rel="manifest" href="/manifest.json" />
{/* Open Graph / Facebook */}
<meta name="og:title" content={title} />
<meta name="og:description" content={description} />
{ogImage && <meta name="og:image" content={ogImage} />}
<meta property="og:locale" content="en_US"/>
<meta property="og:type" content="website" />
<meta property="og:url" content={canonicalURL} />
{/* Twitter */}
<meta name="twitter:card" content="summary"></meta>
<meta name="twitter:title" content={title} />
<meta name="twitter:description" content={description} />
{ogImage && <meta name="twitter:image" content={ogImage} />}


