From 86b59b6cfc569ea4f9d844712ded3f8304250da7 Mon Sep 17 00:00:00 2001 From: LooseLi <1329307562@qq.com> Date: Thu, 20 Mar 2025 11:50:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(sitemap=E5=A4=9A=E4=BA=86=E4=B8=AA?= =?UTF-8?q?=E6=96=9C=E6=9D=A0=E5=AF=BC=E8=87=B4Google=20Search=20Console?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E8=87=AA=E5=8A=A8=E7=BC=96=E5=85=A5=E7=B4=A2?= =?UTF-8?q?=E5=BC=95)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/sitemap.xml.js | 6 +++++- pages/sitemap.xml.js | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/sitemap.xml.js b/lib/sitemap.xml.js index c847e57d..1ff513f7 100644 --- a/lib/sitemap.xml.js +++ b/lib/sitemap.xml.js @@ -6,7 +6,11 @@ import { siteConfig } from './config' * @param {*} param0 */ export async function generateSitemapXml({ allPages, NOTION_CONFIG }) { - const link = siteConfig('LINK', BLOG.LINK, NOTION_CONFIG) + let link = siteConfig('LINK', BLOG.LINK, NOTION_CONFIG) + // 确保链接不以斜杠结尾 + if (link && link.endsWith('/')) { + link = link.slice(0, -1) + } const urls = [ { loc: `${link}`, diff --git a/pages/sitemap.xml.js b/pages/sitemap.xml.js index e6b33bb2..06c21f42 100644 --- a/pages/sitemap.xml.js +++ b/pages/sitemap.xml.js @@ -38,6 +38,11 @@ export const getServerSideProps = async ctx => { } function generateLocalesSitemap(link, allPages, locale) { + // 确保链接不以斜杠结尾 + if (link && link.endsWith('/')) { + link = link.slice(0, -1) + } + if (locale && locale.length > 0 && locale.indexOf('/') !== 0) { locale = '/' + locale } From 379d0dbc044e2e7a7623dfeecfcd9b55f1832430 Mon Sep 17 00:00:00 2001 From: LooseLi <1329307562@qq.com> Date: Thu, 20 Mar 2025 14:03:46 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix(=E8=87=AA=E5=AE=9A=E4=B9=89=E5=A4=87?= =?UTF-8?q?=E6=A1=88=E9=93=BE=E6=8E=A5=E4=B8=8D=E7=94=9F=E6=95=88)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/fukasawa/components/SiteInfo.js | 2 +- themes/gitbook/components/Footer.js | 2 +- themes/heo/components/Footer.js | 3 ++- themes/matery/components/Footer.js | 2 +- themes/medium/components/Footer.js | 2 +- themes/movie/components/Footer.js | 2 +- themes/nav/components/Footer.js | 2 +- themes/next/components/Footer.js | 2 +- themes/photo/components/Footer.js | 2 +- 9 files changed, 10 insertions(+), 9 deletions(-) diff --git a/themes/fukasawa/components/SiteInfo.js b/themes/fukasawa/components/SiteInfo.js index 1052ae47..0651c88c 100644 --- a/themes/fukasawa/components/SiteInfo.js +++ b/themes/fukasawa/components/SiteInfo.js @@ -22,7 +22,7 @@ function SiteInfo({ title }) { {siteConfig('BEI_AN') && ( <> - + {siteConfig('BEI_AN')}
diff --git a/themes/gitbook/components/Footer.js b/themes/gitbook/components/Footer.js index b9929d64..cbf6df14 100644 --- a/themes/gitbook/components/Footer.js +++ b/themes/gitbook/components/Footer.js @@ -33,7 +33,7 @@ const Footer = ({ siteInfo }) => { {siteConfig('BEI_AN') && ( <> {' '} - + {siteConfig('BEI_AN')} diff --git a/themes/heo/components/Footer.js b/themes/heo/components/Footer.js index 2bd1bf64..1a7e6fb8 100644 --- a/themes/heo/components/Footer.js +++ b/themes/heo/components/Footer.js @@ -9,6 +9,7 @@ import SocialButton from './SocialButton' */ const Footer = () => { const BEI_AN = siteConfig('BEI_AN') + const BEI_AN_LINK = siteConfig('BEI_AN_LINK') const BIO = siteConfig('BIO') return (