diff --git a/blog.config.js b/blog.config.js
index 65683d0d..ae020dac 100644
--- a/blog.config.js
+++ b/blog.config.js
@@ -114,7 +114,9 @@ const BLOG = {
CODE_MAC_BAR: process.env.NEXT_PUBLIC_CODE_MAC_BAR || true, // 代码左上角显示mac的红黄绿图标
CODE_LINE_NUMBERS: process.env.NEXT_PUBLIC_CODE_LINE_NUMBERS || false, // 是否显示行号
- CODE_COLLAPSE: process.env.NEXT_PUBLIC_CODE_COLLAPSE || true, // 是否折叠代码框
+ CODE_COLLAPSE: process.env.NEXT_PUBLIC_CODE_COLLAPSE || true, // 是否支持折叠代码框
+ CODE_COLLAPSE_EXPAND_DEFAULT: process.env.NEXT_PUBLIC_CODE_COLLAPSE_EXPAND_DEFAULT || true, // 折叠代码默认是展开状态
+
// END********代码相关********
// Mermaid 图表CDN
diff --git a/components/PrismMac.js b/components/PrismMac.js
index 0a69e55e..3e568e9f 100644
--- a/components/PrismMac.js
+++ b/components/PrismMac.js
@@ -105,13 +105,20 @@ const renderCollapseCode = () => {
codeBlock.parentNode.insertBefore(collapseWrapper, codeBlock)
panel.appendChild(codeBlock)
- header.addEventListener('click', () => {
+ function collapseCode() {
panel.classList.toggle('invisible')
panel.classList.toggle('h-0')
panel.classList.toggle('h-auto')
header.querySelector('svg').classList.toggle('rotate-180')
panelWrapper.classList.toggle('border-gray-300')
- })
+ }
+
+ // 点击后折叠展开代码
+ header.addEventListener('click', collapseCode)
+ // 是否自动展开
+ if (JSON.parse(BLOG.CODE_COLLAPSE_EXPAND_DEFAULT)) {
+ header.click()
+ }
}
}
diff --git a/lib/notion/mapImage.js b/lib/notion/mapImage.js
index f25eda99..0406507f 100644
--- a/lib/notion/mapImage.js
+++ b/lib/notion/mapImage.js
@@ -67,13 +67,10 @@ const mapImgUrl = (img, block, type = 'block', from) => {
ret = BLOG.NOTION_HOST + '/image/' + encodeURIComponent(ret) + '?table=' + type + '&id=' + block.id
}
- // UnSplash 随机图片接口优化
- if (ret.includes('source.unsplash.com/random')) {
- // 检查原始URL是否已经包含参数
- const separator = ret.includes('?') ? '&' : '?'
- // 拼接唯一识别参数,防止请求的图片被缓存
- ret = `${ret}${separator}random=${block.id}`
- }
+ // 随机图片接口优化 防止因url一致而随机结果相同
+ const separator = ret.includes('?') ? '&' : '?'
+ // 拼接唯一识别参数,防止请求的图片被缓存
+ ret = `${ret.trim()}${separator}t=${block.id}`
// 文章封面
if (from === 'pageCoverThumbnail') {
diff --git a/themes/heo/components/Hero.js b/themes/heo/components/Hero.js
index 14cad8b0..a0ff3f73 100644
--- a/themes/heo/components/Hero.js
+++ b/themes/heo/components/Hero.js
@@ -253,7 +253,7 @@ function TopGroup(props) {
)
})}
-
+
)
}
@@ -301,7 +301,7 @@ function getTopPosts({ latestPosts, allNavPages }) {
* 英雄区右侧,今日卡牌
* @returns
*/
-function TodayCard({ cRef }) {
+function TodayCard({ cRef, siteInfo }) {
const router = useRouter()
// 卡牌是否盖住下层
const [isCoverUp, setIsCoverUp] = useState(true)
@@ -378,8 +378,7 @@ function TodayCard({ cRef }) {
isCoverUp ? '' : ' pointer-events-none'
} cursor-pointer today-card-cover absolute w-full h-full top-0`}
style={{
- background:
- "url('https://bu.dusays.com/2023/03/12/640dcd3a1b146.png') no-repeat center /cover"
+ background: `url('${siteInfo?.pageCover}') no-repeat center /cover`
}}
>
diff --git a/themes/heo/config.js b/themes/heo/config.js
index f62be177..a979621c 100644
--- a/themes/heo/config.js
+++ b/themes/heo/config.js
@@ -25,6 +25,7 @@ const CONFIG = {
// 英雄区右侧推荐文章标签, 例如 [推荐] , 最多六篇文章; 若留空白'',则推荐最近更新文章
HERO_RECOMMEND_POST_TAG: '推荐',
HERO_RECOMMEND_POST_SORT_BY_UPDATE_TIME: false, // 推荐文章排序,为`true`时将强制按最后修改时间倒序
+ // HERO_RECOMMEND_COVER: 'https://cdn.pixabay.com/photo/2015/10/30/20/13/sunrise-1014712_1280.jpg', // 英雄区右侧图片
// 右侧个人资料卡牌欢迎语,点击可自动切换
INFOCARD_GREETINGS: [
diff --git a/themes/hexo/components/BlogPostCard.js b/themes/hexo/components/BlogPostCard.js
index dc1d9759..f1febbdd 100644
--- a/themes/hexo/components/BlogPostCard.js
+++ b/themes/hexo/components/BlogPostCard.js
@@ -9,7 +9,7 @@ import LazyImage from '@/components/LazyImage'
const BlogPostCard = ({ index, post, showSummary, siteInfo }) => {
const showPreview = CONFIG.POST_LIST_PREVIEW && post.blockMap
if (post && !post.pageCoverThumbnail && CONFIG.POST_LIST_COVER_DEFAULT) {
- post.pageCover = siteInfo?.pageCoverThumbnail
+ post.pageCoverThumbnail = siteInfo?.pageCover
}
const showPageCover = CONFIG.POST_LIST_COVER && post?.pageCoverThumbnail && !showPreview
// const delay = (index % 2) * 200
diff --git a/themes/hexo/components/MenuGroupCard.js b/themes/hexo/components/MenuGroupCard.js
index 574a8e5b..5be22e2b 100644
--- a/themes/hexo/components/MenuGroupCard.js
+++ b/themes/hexo/components/MenuGroupCard.js
@@ -16,6 +16,12 @@ const MenuGroupCard = (props) => {
{ name: locale.COMMON.TAGS, to: '/tag', slot: tagSlot, show: CONFIG.MENU_TAG }
]
+ for (let i = 0; i < links.length; i++) {
+ if (links[i].id !== i) {
+ links[i].id = i
+ }
+ }
+
return (