diff --git a/components/Utterances.js b/components/Utterances.js
index 34c4f09c958..db707c2d89c 100644
--- a/components/Utterances.js
+++ b/components/Utterances.js
@@ -15,8 +15,11 @@ const Utterances = ({ issueTerm, layout }) => {
const [isLoading, setLoading] = useState(true);
useEffect(() => {
- const script = document.createElement('script');
const anchor = document.getElementById('comments');
+ if(!anchor){
+ return
+ }
+ const script = document.createElement('script');
script.onload = () => setLoading(false);
script.setAttribute('src', 'https://utteranc.es/client.js');
script.setAttribute('crossorigin', 'anonymous');
@@ -25,7 +28,7 @@ const Utterances = ({ issueTerm, layout }) => {
script.setAttribute('issue-term', 'title');
// 初始主题
script.setAttribute('theme', isDarkMode ? 'github-dark' : 'github-light');
- anchor.appendChild(script);
+ anchor?.appendChild(script);
return () => {
// anchor.innerHTML = ''
diff --git a/themes/nav/components/BlogPostItem.js b/themes/nav/components/BlogPostItem.js
index 5d8c640685f..98859178ea8 100755
--- a/themes/nav/components/BlogPostItem.js
+++ b/themes/nav/components/BlogPostItem.js
@@ -10,10 +10,6 @@ import BlogPostCard from './BlogPostCard'
*/
const BlogPostItem = (props) => {
const { group } = props
-
- console.log('####### group')
- console.log(group)
-
if (group?.category) {
return <>
diff --git a/themes/nav/components/MenuItem.js b/themes/nav/components/MenuItem.js
index 79333157721..f1b1acc1eb1 100644
--- a/themes/nav/components/MenuItem.js
+++ b/themes/nav/components/MenuItem.js
@@ -21,7 +21,8 @@ export const MenuItem = ({ link }) => {
}
// #号加标题 快速跳转到指定锚点
- const url = link?.to && link?.to.length > 0 ? link.to : '#' + link?.title
+ const url = link?.to && link?.to !=='#' ? link.to : ('#' + link.name)
+ console.log(link,url , '#' + link.name)
return <>
{/* 菜单 */}
@@ -53,7 +54,7 @@ export const MenuItem = ({ link }) => {
{
link?.subMenus?.map((sLink, index) => {
// #号加标题 快速跳转到指定锚点
- const sUrl = sLink?.to && sLink?.to.length > 0 ? sLink.to : '#' + sLink?.title
+ const sUrl = sLink?.to && sLink?.to.length !=='#' ? sLink.to : ('#' + sLink.name)
return
{sLink.title}
diff --git a/themes/nav/index.js b/themes/nav/index.js
index 742704c86ff..b09fe08058d 100755
--- a/themes/nav/index.js
+++ b/themes/nav/index.js
@@ -195,7 +195,7 @@ const LayoutPostList = props => {
// 顶部如果是按照分类或标签查看文章列表,列表顶部嵌入一个横幅
// 如果是搜索,则列表顶部嵌入 搜索框
return (
-
+ <>
{posts?.map(post => (
@@ -203,7 +203,7 @@ const LayoutPostList = props => {
))}
-
+ >
)
}
@@ -216,7 +216,7 @@ const LayoutSlug = (props) => {
const { post, lock, validPassword } = props
return (
-
+ <>
{/* 文章锁 */}
{lock && }
@@ -250,7 +250,7 @@ const LayoutSlug = (props) => {
}
-
+ >
)
}
@@ -271,14 +271,14 @@ const LayoutSearch = (props) => {
* @returns
*/
const LayoutArchive = (props) => {
- return
+ return
// const { archivePosts } = props
- return
+ return <>
{Object.keys(archivePosts)?.map(archiveTitle => )}
-
+ >
}
/**
@@ -296,7 +296,7 @@ const Layout404 = props => {
const LayoutCategoryIndex = (props) => {
const { categoryOptions } = props
const { locale } = useGlobal()
- return
+ return <>
{locale.COMMON.CATEGORY}:
@@ -318,18 +318,18 @@ const LayoutCategoryIndex = (props) => {
})}
-
+ >
}
/**
* 标签列表
*/
const LayoutTagIndex = (props) => {
- return
+ return
// const { tagOptions } = props
// const { locale } = useGlobal()
- return
+ return <>
@@ -345,7 +345,7 @@ const LayoutTagIndex = (props) => {
})}
-
+ >
}
export {