优化SEO
This commit is contained in:
1 parent
b502d21818
commit
1ba06d3ff3
24 files changed
+224
-34
No files matched your search
@@ -0,0 +1,71 @@
|
||||
---
|
||||
import { site } from "../data/site";
|
||||
|
||||
interface Props {
|
||||
title?: string;
|
||||
description?: string;
|
||||
image?: string;
|
||||
noindex?: boolean;
|
||||
}
|
||||
|
||||
const {
|
||||
title = site.name,
|
||||
description = site.description,
|
||||
image = site.heroImage,
|
||||
noindex = false
|
||||
} = Astro.props;
|
||||
|
||||
const documentTitle = title === site.name || title.includes(site.name)
|
||||
? title
|
||||
: `${title} · ${site.name}`;
|
||||
const baseUrl = Astro.site ?? new URL(site.url);
|
||||
const canonicalUrl = new URL(Astro.url.pathname, baseUrl);
|
||||
const imageUrl = new URL(image, baseUrl);
|
||||
const robots = noindex
|
||||
? "noindex, nofollow"
|
||||
: "index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1";
|
||||
const structuredData = {
|
||||
"@context": "https://schema.org",
|
||||
"@graph": [
|
||||
{
|
||||
"@type": "WebSite",
|
||||
"@id": `${new URL("/", baseUrl)}#website`,
|
||||
url: new URL("/", baseUrl).toString(),
|
||||
name: site.name,
|
||||
alternateName: [site.shortName, `${site.cohort}${site.shortName}`],
|
||||
description: site.description,
|
||||
inLanguage: "zh-CN"
|
||||
},
|
||||
{
|
||||
"@type": "WebPage",
|
||||
"@id": `${canonicalUrl}#webpage`,
|
||||
url: canonicalUrl.toString(),
|
||||
name: documentTitle,
|
||||
description,
|
||||
isPartOf: { "@id": `${new URL("/", baseUrl)}#website` },
|
||||
inLanguage: "zh-CN"
|
||||
}
|
||||
]
|
||||
};
|
||||
---
|
||||
|
||||
<title>{documentTitle}</title>
|
||||
<meta name="description" content={description} />
|
||||
<meta name="robots" content={robots} />
|
||||
<link rel="canonical" href={canonicalUrl} />
|
||||
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:locale" content="zh_CN" />
|
||||
<meta property="og:site_name" content={site.name} />
|
||||
<meta property="og:title" content={documentTitle} />
|
||||
<meta property="og:description" content={description} />
|
||||
<meta property="og:url" content={canonicalUrl} />
|
||||
<meta property="og:image" content={imageUrl} />
|
||||
<meta property="og:image:alt" content={`${site.name}校园记忆`} />
|
||||
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:title" content={documentTitle} />
|
||||
<meta name="twitter:description" content={description} />
|
||||
<meta name="twitter:image" content={imageUrl} />
|
||||
|
||||
<script is:inline type="application/ld+json" set:html={JSON.stringify(structuredData)} />
|
||||
@@ -907,7 +907,7 @@
|
||||
"displayDate": "2025.05.28",
|
||||
"sourceUrl": "https://mp.weixin.qq.com/s/BzwaFT3_-lTwkz1keEexZg",
|
||||
"cover": "/assets/article-covers/cover-325470909f3b.webp",
|
||||
"excerpt": "网站群于今日起上线试运营。 共三个站点: 主站点:https://class612.bond",
|
||||
"excerpt": "网站群于今日起上线试运营。 共三个站点: 主站点:https://www.2024612.xyz/",
|
||||
"category": "校园通知",
|
||||
"fileName": "网站群上线通知.md",
|
||||
"coverSourceUrl": "https://mmbiz.qpic.cn/sz_mmbiz_jpg/RKNa5pic8piampaibDJNlrCiawqhia3LzibyNa3MNNlEAUAOqz6Fxyurqr4ic3YokNjqMPazGibr1vl2lQX67PLwVWWFlg/640?wx_fmt=jpeg"
|
||||
|
||||
+8
-2
@@ -1,11 +1,17 @@
|
||||
export const site = {
|
||||
className: "2024届612班",
|
||||
name: "高平一中612班",
|
||||
shortName: "612班",
|
||||
className: "高平一中612班",
|
||||
cohort: "2024届",
|
||||
url: "https://www.2024612.xyz/",
|
||||
title: "毕业后,我们依然在场",
|
||||
subtitle:
|
||||
"把散落在相册、聊天记录和心里的瞬间放回同一个地方。这里先留给高中的三年,也留给一年后的我们。",
|
||||
description:
|
||||
"高平一中2024届612班纪念网站,收录三年时间线、班级照片、青春刊物和同学近况,保存我们共同走过的高中时光。",
|
||||
anniversary: "2024.06 - 2026.06 · 毕业周年纪念",
|
||||
heroImage: "/assets/campus-hero.png",
|
||||
footer: "2024届612班纪念网站"
|
||||
footer: "高平一中612班纪念网站"
|
||||
};
|
||||
|
||||
export const contactLinks = [
|
||||
|
||||
Loaded 3 of 24 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user