From a515ecae3965ae5a4ee0fb5bf270ea671ddb204e Mon Sep 17 00:00:00 2001 From: Han <1655466387@qq.com> Date: Fri, 6 Jun 2025 11:02:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BB=86=E8=8A=82=E2=9C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Aside/Aside.less | 4 ++++ src/components/Head/Head.astro | 5 +++-- src/components/Reward/Reward.astro | 24 ++++++++++++++++++++---- src/pages/robots.txt.ts | 4 +--- src/scripts/TypeWrite.ts | 3 ++- 5 files changed, 30 insertions(+), 10 deletions(-) diff --git a/src/components/Aside/Aside.less b/src/components/Aside/Aside.less index 8b78a73..cdaf6be 100644 --- a/src/components/Aside/Aside.less +++ b/src/components/Aside/Aside.less @@ -205,6 +205,10 @@ aside.vh-aside { p { padding: 0.28rem 0; } + + img { + max-width: 100%; + } } } diff --git a/src/components/Head/Head.astro b/src/components/Head/Head.astro index 15303fb..a8da8b0 100644 --- a/src/components/Head/Head.astro +++ b/src/components/Head/Head.astro @@ -10,8 +10,9 @@ const WebTitle = Title || SiteName; const SiteCover = Site + Cover; const WebCover = PageCover || SiteCover; // Schema.org 结构化数据(JSON-LD) -const WebSiteData = { "@context": "https://schema.org", "@type": "WebSite", name: WebTitle, url: canonicalURL, image: { "@type": "ImageObject", url: SiteCover } }; -const ArticleData = { "@context": "https://schema.org", "@type": "BlogPosting", headline: WebTitle, image: [WebCover], author: { "@type": "Person", name: Author, url: Site }, publisher: { "@type": "Organization", name: SiteName, logo: { "@type": "ImageObject", url: SiteCover } } }; +const WebSiteData = { "@context": "https://schema.org", "@type": "WebSite", url: canonicalURL, name: WebTitle, description: Description, inLanguage: "zh-CN", image: WebCover, publisher: { "@type": "Organization", name: WebTitle, logo: { "@type": "ImageObject", url: SiteCover } } }; +const ArticleData = { "@context": "https://schema.org", "@type": "BlogPosting", mainEntityOfPage: { "@type": "WebPage", "@id": canonicalURL }, headline: WebTitle, description: Description, image: [WebCover], datePublished: new Date().toISOString().replace("Z", `+08:00`), dateModified: new Date().toISOString().replace("Z", `+08:00`), author: { "@type": "Person", name: Author, url: Site }, publisher: { "@type": "Organization", name: SiteName, logo: { "@type": "ImageObject", url: SiteCover } }, keywords: (Keywords || ["Astro", "分享", "博客"]).join(", ") }; + // 基础 样式 import "@/styles/Base.less"; --- diff --git a/src/components/Reward/Reward.astro b/src/components/Reward/Reward.astro index fc56d74..0850abb 100644 --- a/src/components/Reward/Reward.astro +++ b/src/components/Reward/Reward.astro @@ -3,7 +3,23 @@ import SITE_INFO from "@/config"; import "./Reward.less"; --- - - 喜欢这篇文章嘛,觉得文章不错的话,奖励奖励我! - 支付宝 微信 - +{ + SITE_INFO.Reward.AliPay && SITE_INFO.Reward.WeChat && ( + + 喜欢这篇文章嘛,觉得文章不错的话,奖励奖励我! + + {SITE_INFO.Reward.AliPay && ( + + + 支付宝 + + )} + {SITE_INFO.Reward.WeChat && ( + + 微信 + + )} + + + ) +} diff --git a/src/pages/robots.txt.ts b/src/pages/robots.txt.ts index cb7e679..3877519 100644 --- a/src/pages/robots.txt.ts +++ b/src/pages/robots.txt.ts @@ -1,9 +1,7 @@ import type { APIRoute } from 'astro'; const getRobotsTxt = (sitemapURL: URL) => `User-agent: * -Disallow: /MineWeb/ -Disallow: /assets/ -Disallow: /*?* +Allow: / Sitemap: ${sitemapURL.href}`; diff --git a/src/scripts/TypeWrite.ts b/src/scripts/TypeWrite.ts index fbbab63..3e91ef6 100644 --- a/src/scripts/TypeWrite.ts +++ b/src/scripts/TypeWrite.ts @@ -2,7 +2,8 @@ import SITE_INFO from '@/config'; export default () => { const writeDom = document.querySelector('.header-main>.desc'); if (!writeDom) return; - const TypeWriteList = SITE_INFO.TypeWriteList; + const TypeWriteList: any = SITE_INFO.TypeWriteList; + if (!Array.isArray(TypeWriteList) || !TypeWriteList.length) return writeDom.remove(); let TypeWriteListIndex = 0; let index = 0; let isDeleting = false;
喜欢这篇文章嘛,觉得文章不错的话,奖励奖励我!