---
import 'chota/dist/chota.min.css';
import '../styles/global.css';

import Header from '../components/Header.astro';
import Footer from '../components/Footer.astro';

export interface Props {
  title?: string;
  description?: string;
  image?: string;
}

const {
  title: titleProp,
  description = 'Cats of people working in the tech industry',
  image
} = Astro.props;

const title = `${titleProp ? `${titleProp} - ` : ''}Cats Of Tech`;
const imageUrl = image ? new URL(image, Astro.url) : null;
---

<html lang="en">
  <head>
    <meta charset="utf-8" />
    <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
    <meta name="viewport" content="width=device-width" />
    <title>{title}</title>
    <meta name="generator" content={Astro.generator} />
    <meta name="description" content={description} />
    <meta property="twitter:card" content="summary" />
    <meta property="og:title" content={title} />
    <meta property="twitter:title" content={title} />
    <meta property="og:description" content={description} />
    <meta property="twitter:description" content={description} />
    {
      imageUrl && (
        <>
          <meta property="og:image" content={imageUrl} />
          <meta property="twitter:description" content={imageUrl} />
        </>
      )
    }
  </head>
  <body>
    <Header />
    <main>
      <slot />
    </main>
    <Footer />
  </body>
</html>
