jerryc127 / hexo-theme-butterfly

🦋 A Hexo Theme: Butterfly
https://butterfly.js.org
Apache License 2.0
7.11k stars 1.28k forks source link

[Bug]: Cannot read property 'enable' of undefined #1392

Closed imba97 closed 10 months ago

imba97 commented 11 months ago

使用的 Butterfly 版本? | What version of Butterfly are you use?

4.10

是否修改过主题文件? || Has the theme files been modified?

不是 (No)

使用的瀏覽器? || What browse are you using?

Chrome

使用的系統? || What operating system are you using?

Windows

問題描述 | Describe the bug

希望能做好向前兼容,不然每次更新都需要对比配置文件,感谢

image

出現問題網站 | Website

none(构建过程中的问题)

imba97 commented 11 months ago

经过对比是没有 series 配置

hexo.extend.filter.register('before_post_render', data => {
  if (!hexo.theme.config.series.enable) return data
  const { layout, series } = data
  if (layout === 'post' && series) {
    groups[series] = groups[series] || []
    groups[series].push({
      title: data.title,
      path: data.path,
      date: data.date.unix()
    })
  }
  return data
})

希望可以做个类似 lodash.get(hexo.theme.config, 'series.enable', false)

不建议直接 hexo.theme.config.series.enable 取值

github-actions[bot] commented 10 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.