Files
iptvnator/apps/website/src/components/BaseHead.astro
T
4gray 16fede1180 docs(blog): add favicon
Entire-Checkpoint: c6e522b4276c
2026-04-27 00:24:23 +02:00

89 lines
3.4 KiB
Plaintext

---
interface Props {
title: string;
description: string;
image?: string;
type?: 'website' | 'article';
noindex?: boolean;
keywords?: string[];
publishedTime?: string;
modifiedTime?: string;
jsonLd?: Record<string, unknown> | Array<Record<string, unknown>>;
}
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
const {
title,
description,
image = '/iptvnator/og-image.png',
type = 'website',
noindex = false,
keywords = [],
publishedTime,
modifiedTime,
jsonLd,
} = Astro.props;
const absoluteImageURL = new URL(image, Astro.site);
const robotsContent = noindex
? 'noindex, nofollow, noarchive'
: 'index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1';
const schemaPayload = jsonLd
? JSON.stringify(Array.isArray(jsonLd) ? jsonLd : [jsonLd])
: null;
---
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="/iptvnator/favicon.ico" sizes="any" />
<link rel="icon" type="image/png" sizes="16x16" href="/iptvnator/favicon-16x16.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/iptvnator/favicon-32x32.png" />
<link rel="apple-touch-icon" sizes="180x180" href="/iptvnator/apple-touch-icon.png" />
<link rel="manifest" href="/iptvnator/site.webmanifest" />
<meta name="generator" content={Astro.generator} />
<meta name="robots" content={robotsContent} />
<meta name="referrer" content="strict-origin-when-cross-origin" />
<meta name="author" content="4gray" />
<meta name="theme-color" content="#0a0a08" />
<meta name="format-detection" content="telephone=no" />
{keywords.length > 0 && <meta name="keywords" content={keywords.join(', ')} />}
<!-- Fonts: Playfair Display (display), DM Sans (body), IBM Plex Mono (code) -->
<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=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400;1,500;1,600;1,700&family=DM+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=IBM+Plex+Mono:wght@400;500&display=swap"
rel="stylesheet"
/>
<!-- Canonical URL -->
<link rel="canonical" href={canonicalURL.toString()} />
<!-- Primary Meta Tags -->
<title>{title}</title>
<meta name="title" content={title} />
<meta name="description" content={description} />
<!-- Open Graph / Facebook -->
<meta property="og:type" content={type} />
<meta property="og:site_name" content="IPTVnator" />
<meta property="og:locale" content="en_US" />
<meta property="og:url" content={canonicalURL.toString()} />
<meta property="og:title" content={title} />
<meta property="og:description" content={description} />
<meta property="og:image" content={absoluteImageURL.toString()} />
<meta property="og:image:secure_url" content={absoluteImageURL.toString()} />
{type === 'article' && publishedTime && <meta property="article:published_time" content={publishedTime} />}
{type === 'article' && modifiedTime && <meta property="article:modified_time" content={modifiedTime} />}
<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:url" content={canonicalURL.toString()} />
<meta property="twitter:title" content={title} />
<meta property="twitter:description" content={description} />
<meta property="twitter:image" content={absoluteImageURL.toString()} />
{schemaPayload && (
<script type="application/ld+json" set:html={schemaPayload} />
)}