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 } 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 (