diff --git a/lib/lang.js b/lib/lang.js index a6ef7b57..9a0c540d 100644 --- a/lib/lang.js +++ b/lib/lang.js @@ -127,6 +127,10 @@ export const redirectUserLang = (lang, pageId) => { if (!window.location.pathname === '/') { return } + // 没有开启多语言 + if (BLOG.NOTION_PAGE_ID.indexOf(',') < 0) { + return + } const userLang = getQueryVariable('locale') || diff --git a/next.config.js b/next.config.js index 5e5937cd..ac305e34 100644 --- a/next.config.js +++ b/next.config.js @@ -15,7 +15,7 @@ const themes = scanSubdirectories(path.resolve(__dirname, 'themes')) const locales = (function () { // 根据BLOG_NOTION_PAGE_ID 检查支持多少种语言数据. // 支持如下格式配置多个语言的页面id xxx,zh:xxx,en:xxx - const langs = ['zh', 'en'] + let langs = [BLOG.LANG.slice(0, 2)] if (BLOG.NOTION_PAGE_ID.indexOf(',') > 0) { const siteIds = BLOG.NOTION_PAGE_ID.split(',') for (let index = 0; index < siteIds.length; index++) {