feat: add the JSON-LD schema.

This commit is contained in:
Yufan Sheng 2024-10-18 11:01:12 +08:00
parent 63df19113f
commit 5b719dcdf7
Signed by: syhily
GPG Key ID: 9D18A22A7DCD5A9B

View File

@ -12,6 +12,7 @@ import Header from '@/components/header/Header.astro';
import PageMeta from '@/components/meta/PageMeta.astro'; import PageMeta from '@/components/meta/PageMeta.astro';
import SearchDialog from '@/components/search/SearchDialog.astro'; import SearchDialog from '@/components/search/SearchDialog.astro';
import options from '@/options'; import options from '@/options';
import { urlJoin } from '@/helpers/tools';
interface Props { interface Props {
title?: string; title?: string;
@ -47,6 +48,26 @@ const description = Astro.props.description || options.description;
<link rel="icon" href="/favicon.svg" type="image/svg+xml" /> <link rel="icon" href="/favicon.svg" type="image/svg+xml" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" /> <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<link rel="manifest" href="/manifest.webmanifest" /> <link rel="manifest" href="/manifest.webmanifest" />
<script
type="application/ld+json"
set:html={JSON.stringify({
'@type': 'WebSite',
publisher: {
'@type': 'Organization',
name: options.title,
url: options.website,
logo: {
'@type': 'ImageObject',
url: urlJoin(options.website, '/logo.svg'),
width: 96,
height: 96,
},
},
url: options.website,
mainEntityOfPage: options.website,
description: options.description,
})}
/>
</head> </head>
<body class="home blog"> <body class="home blog">
<div class="site-layout"> <div class="site-layout">