-
{post.title}
diff --git a/themes/fukasawa/components/BlogListEmpty.js b/themes/fukasawa/components/BlogListEmpty.js
index 41b42e73..59c5c892 100644
--- a/themes/fukasawa/components/BlogListEmpty.js
+++ b/themes/fukasawa/components/BlogListEmpty.js
@@ -1,3 +1,4 @@
+import { useGlobal } from '@/lib/global'
/**
* 空白博客 列表
@@ -5,8 +6,9 @@
* @constructor
*/
const BlogListEmpty = ({ currentSearch }) => {
+ const { locale } = useGlobal()
return
-
没有找到文章 {(currentSearch &&
{currentSearch}
)}
+
{locale.COMMON.NO_RESULTS_FOUND} {(currentSearch &&
{currentSearch}
)}
}
export default BlogListEmpty
diff --git a/themes/fukasawa/components/MailChimpForm.js b/themes/fukasawa/components/MailChimpForm.js
new file mode 100644
index 00000000..f2e990e5
--- /dev/null
+++ b/themes/fukasawa/components/MailChimpForm.js
@@ -0,0 +1,62 @@
+import { useEffect, useRef, useState } from 'react'
+import { subscribeToNewsletter } from '@/lib/mailchimp'
+import { siteConfig } from '@/lib/config'
+import CONFIG from '../config'
+import { useGlobal } from '@/lib/global'
+
+/**
+ * 邮件订阅表单
+ * @returns
+ */
+export default function MailChimpForm() {
+ const formRef = useRef()
+ const [success, setSuccess] = useState(false)
+ const { locale } = useGlobal()
+
+ useEffect(() => {
+ const form = formRef.current
+ const handleSubmit = (e) => {
+ e.preventDefault()
+ const email = document.querySelector('#newsletter').value
+ subscribeToNewsletter(email).then(response => {
+ console.log('Subscription succeeded:', response)
+ // 在此处添加成功订阅后的操作
+ setSuccess(true)
+ })
+ .catch(error => {
+ console.error('Subscription failed:', error)
+ // 在此处添加订阅失败后的操作
+ })
+ }
+ form?.addEventListener('submit', handleSubmit)
+ return () => {
+ form?.removeEventListener('submit', handleSubmit)
+ }
+ }, [subscribeToNewsletter])
+
+ return <>
+ {siteConfig('FUKASAWA_MAILCHIMP_FORM', null, CONFIG) &&
+
{locale.MAILCHIMP.SUBSCRIBE}
+
{locale.MAILCHIMP.MSG}
+
+
+ }
+ >
+}
diff --git a/themes/fukasawa/config.js b/themes/fukasawa/config.js
index 86e641bd..462c54ca 100644
--- a/themes/fukasawa/config.js
+++ b/themes/fukasawa/config.js
@@ -1,4 +1,5 @@
const CONFIG = {
+ FUKASAWA_MAILCHIMP_FORM: false, // 邮件订阅表单
FUKASAWA_POST_LIST_COVER: true, // 文章列表显示图片封面
FUKASAWA_POST_LIST_COVER_FORCE: false, // 即使没有封面也将站点背景图设置为封面
diff --git a/themes/gitbook/components/NavPostListEmpty.js b/themes/gitbook/components/NavPostListEmpty.js
index 207599db..54f2f179 100644
--- a/themes/gitbook/components/NavPostListEmpty.js
+++ b/themes/gitbook/components/NavPostListEmpty.js
@@ -1,3 +1,4 @@
+import { useGlobal } from '@/lib/global'
/**
* 空白博客 列表
@@ -5,8 +6,9 @@
* @constructor
*/
const NavPostListEmpty = ({ currentSearch }) => {
+ const { locale } = useGlobal()
return
-
没有找到文章 {(currentSearch &&
{currentSearch}
)}
+
{locale.COMMON.NO_RESULTS_FOUND} {(currentSearch &&
{currentSearch}
)}
}
export default NavPostListEmpty
diff --git a/themes/medium/components/BlogPostListEmpty.js b/themes/medium/components/BlogPostListEmpty.js
index 86977fd0..a26cf292 100644
--- a/themes/medium/components/BlogPostListEmpty.js
+++ b/themes/medium/components/BlogPostListEmpty.js
@@ -1,3 +1,4 @@
+import { useGlobal } from '@/lib/global'
/**
* 空白博客 列表
@@ -5,8 +6,9 @@
* @constructor
*/
const BlogPostListEmpty = ({ currentSearch }) => {
+ const { locale } = useGlobal()
return
-
没有找到文章 {(currentSearch &&
{currentSearch}
)}
+
{locale.COMMON.NO_RESULTS_FOUND} {(currentSearch &&
{currentSearch}
)}
}
export default BlogPostListEmpty
diff --git a/themes/nav/components/BlogPostListEmpty.js b/themes/nav/components/BlogPostListEmpty.js
index 86977fd0..a26cf292 100755
--- a/themes/nav/components/BlogPostListEmpty.js
+++ b/themes/nav/components/BlogPostListEmpty.js
@@ -1,3 +1,4 @@
+import { useGlobal } from '@/lib/global'
/**
* 空白博客 列表
@@ -5,8 +6,9 @@
* @constructor
*/
const BlogPostListEmpty = ({ currentSearch }) => {
+ const { locale } = useGlobal()
return
-
没有找到文章 {(currentSearch &&
{currentSearch}
)}
+
{locale.COMMON.NO_RESULTS_FOUND} {(currentSearch &&
{currentSearch}
)}
}
export default BlogPostListEmpty
diff --git a/themes/nav/components/NavPostListEmpty.js b/themes/nav/components/NavPostListEmpty.js
index 207599db..54f2f179 100755
--- a/themes/nav/components/NavPostListEmpty.js
+++ b/themes/nav/components/NavPostListEmpty.js
@@ -1,3 +1,4 @@
+import { useGlobal } from '@/lib/global'
/**
* 空白博客 列表
@@ -5,8 +6,9 @@
* @constructor
*/
const NavPostListEmpty = ({ currentSearch }) => {
+ const { locale } = useGlobal()
return
-
没有找到文章 {(currentSearch &&
{currentSearch}
)}
+
{locale.COMMON.NO_RESULTS_FOUND} {(currentSearch &&
{currentSearch}
)}
}
export default NavPostListEmpty
diff --git a/themes/next/components/BlogPostListEmpty.js b/themes/next/components/BlogPostListEmpty.js
index b1d87253..ae09e90d 100644
--- a/themes/next/components/BlogPostListEmpty.js
+++ b/themes/next/components/BlogPostListEmpty.js
@@ -1,3 +1,4 @@
+import { useGlobal } from '@/lib/global'
/**
* 空白博客 列表
@@ -5,8 +6,9 @@
* @constructor
*/
const BlogPostListEmpty = ({ currentSearch }) => {
+ const { locale } = useGlobal()
return
-
没有找到文章 {(currentSearch &&
{currentSearch}
)}
+
{locale.COMMON.NO_RESULTS_FOUND} {(currentSearch &&
{currentSearch}
)}
}
export default BlogPostListEmpty
diff --git a/themes/next/components/WordCount.js b/themes/next/components/WordCount.js
index 2062e69a..ccf146d4 100644
--- a/themes/next/components/WordCount.js
+++ b/themes/next/components/WordCount.js
@@ -1,3 +1,4 @@
+import { useGlobal } from '@/lib/global'
import { useEffect } from 'react'
/**
@@ -9,8 +10,12 @@ export default function WordCount() {
countWords()
})
+ const { locale } = useGlobal()
+
return
- 本文字数 0 | 阅读时长 ≈ 0 分钟
+
+ {locale.COMMON.WORD_COUNT}≈
+ 0 | {locale.COMMON.READ_TIME} ≈ 0 {locale.COMMON.MINUTE}
}