mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-08 23:16:54 +00:00
fix(sitemap多了个斜杠导致Google Search Console无法自动编入索引)
This commit is contained in:
@@ -6,7 +6,11 @@ import { siteConfig } from './config'
|
|||||||
* @param {*} param0
|
* @param {*} param0
|
||||||
*/
|
*/
|
||||||
export async function generateSitemapXml({ allPages, NOTION_CONFIG }) {
|
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 = [
|
const urls = [
|
||||||
{
|
{
|
||||||
loc: `${link}`,
|
loc: `${link}`,
|
||||||
|
|||||||
@@ -38,6 +38,11 @@ export const getServerSideProps = async ctx => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function generateLocalesSitemap(link, allPages, locale) {
|
function generateLocalesSitemap(link, allPages, locale) {
|
||||||
|
// 确保链接不以斜杠结尾
|
||||||
|
if (link && link.endsWith('/')) {
|
||||||
|
link = link.slice(0, -1)
|
||||||
|
}
|
||||||
|
|
||||||
if (locale && locale.length > 0 && locale.indexOf('/') !== 0) {
|
if (locale && locale.length > 0 && locale.indexOf('/') !== 0) {
|
||||||
locale = '/' + locale
|
locale = '/' + locale
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user