933d6874b1
- Introduced rehypeLazyImages plugin for lazy loading images in blog posts. - Updated sitemap integration to include last modified dates for blog posts. - Enhanced Head and BaseLayout components to support additional Open Graph metadata. - Improved RSS feed generation with sanitized content and author information. - Updated manifest.json for a darker theme and standalone display mode. - Added support for language-specific attributes in various components. - Refactored blog post handling to include modified and published timestamps.
79 lines
3.0 KiB
Plaintext
79 lines
3.0 KiB
Plaintext
---
|
|
import type { Thing } from "schema-dts";
|
|
import { config } from "../config";
|
|
import JsonLd from "./JsonLd.astro";
|
|
|
|
type Props = {
|
|
readonly description: string;
|
|
readonly lang: string;
|
|
readonly modifiedTime?: string;
|
|
readonly ogType?: "website" | "article";
|
|
readonly preview: string;
|
|
readonly publishedTime?: string;
|
|
readonly robots?: string;
|
|
readonly schema: Thing[];
|
|
readonly title: string;
|
|
};
|
|
|
|
const { description, lang, modifiedTime, ogType = "website", preview, publishedTime, robots = "index, follow", schema, title } = Astro.props;
|
|
|
|
const canonicalUrl = new URL(Astro.url.pathname, Astro.site);
|
|
const previewUrl = new URL(preview, Astro.site);
|
|
const ogLocale = lang === "ru" ? "ru_RU" : "en_US";
|
|
---
|
|
|
|
<head>
|
|
<!-- Meta Tags -->
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
|
|
<meta name="description" content={description} />
|
|
<meta name="robots" content={robots} />
|
|
<meta name="author" content={config.author.name} />
|
|
|
|
<link href="/feed.xml" rel="alternate" title="RSS" type="application/atom+xml" />
|
|
<link href="/sitemap-index.xml" rel="sitemap" />
|
|
<link href={canonicalUrl} rel="canonical" />
|
|
<link href={config.author.url} rel="author" />
|
|
|
|
<!-- hreflang -->
|
|
<link rel="alternate" hreflang={lang} href={canonicalUrl} />
|
|
<link rel="alternate" hreflang="x-default" href={canonicalUrl} />
|
|
|
|
<title>{title}</title>
|
|
|
|
<!-- Icons -->
|
|
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
|
<link rel="icon" type="image/png" href="/favicon.png" />
|
|
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
|
<link rel="manifest" href="/manifest.json" />
|
|
<meta name="theme-color" content="#181818" />
|
|
|
|
<!-- Open Graph -->
|
|
<meta property="og:type" content={ogType} />
|
|
<meta property="og:site_name" content={config.og.website} />
|
|
<meta property="og:locale" content={ogLocale} />
|
|
<meta property="og:title" content={title} />
|
|
<meta property="og:description" content={description} />
|
|
<meta property="og:url" content={canonicalUrl} />
|
|
<meta property="og:image" content={previewUrl} />
|
|
<meta property="og:image:width" content={String(config.og.dimensions.width)} />
|
|
<meta property="og:image:height" content={String(config.og.dimensions.height)} />
|
|
<meta property="og:image:alt" content={title} />
|
|
|
|
{ogType === "article" && publishedTime && <meta property="article:published_time" content={publishedTime} />}
|
|
{ogType === "article" && modifiedTime && <meta property="article:modified_time" content={modifiedTime} />}
|
|
{ogType === "article" && <meta property="article:author" content={config.author.url} />}
|
|
|
|
<!-- Twitter Cards -->
|
|
<meta name="twitter:card" content="summary_large_image" />
|
|
<meta name="twitter:site" content="@valyaha" />
|
|
<meta name="twitter:creator" content="@valyaha" />
|
|
<meta name="twitter:title" content={title} />
|
|
<meta name="twitter:description" content={description} />
|
|
<meta name="twitter:image" content={previewUrl} />
|
|
<meta name="twitter:image:alt" content={title} />
|
|
|
|
<JsonLd schema={schema} />
|
|
</head>
|