ohroy / hexo-abbrlink

create one and only link for every post for hexo
Do What The F*ck You Want To Public License
369 stars 36 forks source link

auto_category配置项关闭失效 #45

Closed hotsnow-sean closed 4 years ago

hotsnow-sean commented 4 years ago
var opt_AutoCategoryEnable =
      this.config.abbrlink &&
      this.config.abbrlink.auto_category &&
       this.config.abbrlink.auto_category.enable
       ? this.config.abbrlink.auto_category.enable
       : true;

这部分代码应该是去判断是否用户设置了自动分类,否则默认为true 但是当用户设置了false时,这个判断由于false的存在还是false,导致最终依旧不会取到用户设置的值,进而设置false失效,使用过程中总会去生成文章分类。。造成原本写好的分类被改变 因此可以改为:

var opt_AutoCategoryEnable =
      this.config.abbrlink &&
      this.config.abbrlink.auto_category &&
      this.config.abbrlink.auto_category.enable != null
      ? this.config.abbrlink.auto_category.enable
      : true;

这样应该可以了

edfus commented 4 years ago

👍这解决了我的md源文件分类被覆写为categories: uncategorized问题,并在我清除缓存后进行对比实验时仍能复现。

ohroy commented 4 years ago

我将尽快修复此问题

ohroy commented 4 years ago

已经修复此问题