feat: add og description\image\etc

This commit is contained in:
2026-10-07 20:07:03 +05:00
parent fbe6139585
commit 31ace359d7
9 changed files with 122 additions and 9 deletions
+30
View File
@@ -0,0 +1,30 @@
<script lang="ts">
import { SITE_URL } from "$lib/seo";
interface Props {
title: string;
description: string;
/** Путь страницы от корня роутера ("/", "/list-tools", "/tools/…"). */
path: string;
}
let { title, description, path }: Props = $props();
const url = $derived(`${SITE_URL}${path}`);
const image = `${SITE_URL}/og/default.png`;
</script>
<svelte:head>
<title>{title}</title>
<meta name="description" content={description} />
<link rel="canonical" href={url} />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="easy-png-tools" />
<meta property="og:title" content={title} />
<meta property="og:description" content={description} />
<meta property="og:url" content={url} />
<meta property="og:image" content={image} />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content={title} />
<meta name="twitter:description" content={description} />
<meta name="twitter:image" content={image} />
</svelte:head>
+6
View File
@@ -0,0 +1,6 @@
/**
* Публичный URL сайта для canonical/OG (абсолютные URL, включая base-path
* GitHub Pages). После покупки домена меняется здесь — `docs/plan-seo.md` §6.
* Внимание: `$app/paths.base` для этого не подходит — он относительный.
*/
export const SITE_URL = "https://ku6epxboctuk.github.io/easy-png-tools";
+2 -3
View File
@@ -4,6 +4,7 @@
import CatalogHeader from "$lib/components/catalog/CatalogHeader.svelte";
import CatalogToolbar from "$lib/components/catalog/CatalogToolbar.svelte";
import ToolCard from "$lib/components/catalog/ToolCard.svelte";
import Seo from "$lib/components/Seo.svelte";
import { favFirst, isFav } from "$lib/favorites.svelte";
import {
pageDescription,
@@ -37,9 +38,7 @@
);
</script>
<svelte:head>
<title>{t("home.defaultTitle")}</title>
</svelte:head>
<Seo title={t("home.defaultTitle")} description={t("home.heroLead")} path="/" />
<div class="catalog-page">
<CatalogHeader total={PREVIEW_TOTAL} />
+6 -4
View File
@@ -4,6 +4,7 @@
import CatalogHeader from "$lib/components/catalog/CatalogHeader.svelte";
import CatalogToolbar from "$lib/components/catalog/CatalogToolbar.svelte";
import ToolCard from "$lib/components/catalog/ToolCard.svelte";
import Seo from "$lib/components/Seo.svelte";
import { favFirst, isFav } from "$lib/favorites.svelte";
import {
pageDescription,
@@ -37,10 +38,11 @@
);
</script>
<svelte:head>
<title>{t("catalog.pageTitle")}</title>
<meta name="description" content={t("catalog.metaDescription")} />
</svelte:head>
<Seo
title={t("catalog.pageTitle")}
description={t("catalog.metaDescription")}
path="/list-tools"
/>
<div class="catalog-page">
<CatalogHeader total={PREVIEW_TOTAL} />
+12 -1
View File
@@ -1,6 +1,8 @@
<script lang="ts">
import EmptyState from "$lib/components/feedback/EmptyState.svelte";
import SchemaToolView from "$lib/components/schema/SchemaToolView.svelte";
import Seo from "$lib/components/Seo.svelte";
import { pageDescription, pageTitle } from "$lib/i18n/schema-tool-strings";
import { t } from "$lib/i18n/t";
import { getPageBySlug, getTool } from "$lib/registry";
import { SlidersHorizontal as ToolIcon } from "@lucide/svelte";
@@ -14,8 +16,17 @@
const tool = $derived(page ? getTool(page.steps[0].id) : undefined);
</script>
{#if page}
<Seo
title={`easy-png-tools / ${pageTitle(page)}`}
description={pageDescription(page)}
path={`/tools/${page.slug}`}
/>
{/if}
<svelte:head>
<title>easy-png-tools / {page?.title ?? t("toolPage.fallbackTitle")}</title>
{#if !page}
<title>easy-png-tools / {t("toolPage.fallbackTitle")}</title>
{/if}
<meta name="robots" content="noindex, nofollow" />
</svelte:head>