mirror of
https://github.com/Sevichecc/Urara-Blog.git
synced 2025-05-17 14:09:13 +08:00
39 lines
No EOL
1.4 KiB
Svelte
39 lines
No EOL
1.4 KiB
Svelte
<script lang="ts">
|
|
import { dev } from '$app/environment'
|
|
import { head } from '$lib/config/general'
|
|
import { site } from '$lib/config/site'
|
|
import OpenGraph from '$lib/components/head_opengraph.svelte'
|
|
export let post: Urara.Post | undefined = undefined
|
|
export let page: Urara.Page | undefined = undefined
|
|
</script>
|
|
|
|
<svelte:head>
|
|
<meta name="author" content={site.author?.name} />
|
|
{#if post}
|
|
<link rel="canonical" href={site.protocol + site.domain + post.path} />
|
|
{#if post.type === 'article'}
|
|
<title>{post.title} | {site.title}</title>
|
|
{:else if post.type === 'note'}
|
|
<title>{post.summary ?? post.path.slice(1)} | {site.title}</title>
|
|
{/if}
|
|
{#if post.tags}<meta name="keywords" content={post.tags.join(', ')} />{/if}
|
|
{#if post.summary}<meta name="description" content={post.summary} />{/if}
|
|
{:else}
|
|
<meta name="description" content={site.description} />
|
|
<meta name="keywords" content={site.keywords?.join(', ')} />
|
|
{#if page}
|
|
<title>{page.title ?? page.path.slice(1)} | {site.title}</title>
|
|
<link rel="canonical" href={site.protocol + site.domain + page.path} />
|
|
{:else}
|
|
<title>{site.subtitle ? `${site.title} - ${site.subtitle}` : site.title}</title>
|
|
<link rel="canonical" href={site.protocol + site.domain} />
|
|
{/if}
|
|
{/if}
|
|
{#if head.custom}
|
|
{#each head.custom({ dev, post, page }) as tag}
|
|
{@html tag}
|
|
{/each}
|
|
{/if}
|
|
</svelte:head>
|
|
|
|
<OpenGraph {post} {page} /> |