mirror of
https://github.com/Sevichecc/Urara-Blog.git
synced 2025-05-19 23:59:14 +08:00
50 lines
2.2 KiB
Svelte
50 lines
2.2 KiB
Svelte
<script lang="ts">
|
|
import { site } from '$lib/config/site'
|
|
import { any, maskable } from '$lib/config/icon'
|
|
export let post: Urara.Post | undefined = undefined
|
|
export let page: Urara.Page | undefined = undefined
|
|
</script>
|
|
|
|
<svelte:head>
|
|
<meta property="og:site_name" content={site.title} />
|
|
<meta property="og:locale" content={site.lang} />
|
|
{#if post}
|
|
<meta property="og:type" content="article" />
|
|
<meta property="og:url" content={site.protocol + site.domain + post.path} />
|
|
<meta property="article:author" content={site.author.name} />
|
|
<meta property="article:published_time" content={post.published ?? post.created} />
|
|
<meta property="article:modified_time" content={post.updated ?? post.published ?? post.created} />
|
|
{#if post.layout === 'article'}
|
|
<meta property="og:title" content={post.title ?? post.path.slice(1)} />
|
|
<meta property="og:url" content={site.protocol + site.domain + post.path} />
|
|
{#if post.summary}
|
|
<meta property="og:description" content={post.summary} />
|
|
{/if}
|
|
{#if post.image}
|
|
<meta property="og:image" content={site.protocol + site.domain + post.image} />
|
|
<meta name="twitter:card" content="summary_large_image" />
|
|
{:else}
|
|
<meta property="og:image" content={maskable['512'].src ?? any['512'].src ?? any['192'].src} />
|
|
<meta name="twitter:card" content="summary" />
|
|
{/if}
|
|
{#if post.tags}
|
|
{#each post.tags as tag}
|
|
<meta property="article:tag" content={tag} />
|
|
{/each}
|
|
{/if}
|
|
{:else if post.layout === 'note'}
|
|
<meta property="og:title" content={post.path} />
|
|
{/if}
|
|
{:else}
|
|
<meta property="og:type" content="website" />
|
|
<meta property="og:image" content={maskable['512'].src ?? any['512'].src ?? any['192'].src} />
|
|
<meta property="og:description" content={site.description} />
|
|
{#if page}
|
|
<meta property="og:title" content={page.title ?? page.path.slice(1)} />
|
|
<meta property="og:url" content={site.protocol + site.domain + page.path} />
|
|
{:else}
|
|
<meta property="og:title" content={site.title} />
|
|
<meta property="og:url" content={site.protocol + site.domain} />
|
|
{/if}
|
|
{/if}
|
|
</svelte:head>
|