Coder Social home page Coder Social logo

分类时有Bug about hexo-auto-category HOT 3 CLOSED

xu-song avatar xu-song commented on June 10, 2024
分类时有Bug

from hexo-auto-category.

Comments (3)

xu-song avatar xu-song commented on June 10, 2024

文件名不作为category

_post/Programming/Python/排序.md

你提到的这个例子,会生成标签

categories:
  - Programming
  - Python

文件名不作为category应该更符合大众需求吧

关于空分类

类似以下的例子,也可以不生成[]作为category。这个应该影响不大

INFO  Generated: categories [] for post [C++常数优化]

关于hexo s的无限循环

是,hexo s的时候会有问题。我也不知道为什么。
所以我就一直不用hexo s,直接hexo d。

囧o(╯□╰)o

欢迎PR

from hexo-auto-category.

sshwy avatar sshwy commented on June 10, 2024

我不是说文件名要作为category

我也不会把文件名作为category

其实我的重点在于,你的以下代码

var categories = data.slug.split('/');

有问题。

  • 正常情况下,它解析了_post/Programming/Python/排序.md后,category会变成["Programming","Python","排序"],然后在接下来的代码中,用前2个元素(去掉最后一个)来生成标签:
categories:
  - Programming
  - Python
  • 然而在我这里generator的时候,categories变成了["Programming-Python-排序"],然后你再用它生成category,就是空的:
categories: []

就会长成这样。。。。。
您还是有时间修复一下这个Bug吧
还有那个hexo s的Bug。。。不用hexo s我很难受的。。。

from hexo-auto-category.

xu-song avatar xu-song commented on June 10, 2024

哦,你说的这种情况,我没遇到过。是data.slug获取的问题吗?

console.log(data.slug)    //  Programming/Python/排序
console.log(data.source)  //  _post/Programming/Python/排序.md
var categories = data.slug.split('/');  // 正常

你那里的 data.slug解析出来不是这个值吗?可能是hexo版本问题,保险起见 可以采用data.source

hexo s 遇到的问题

我暂时也没找到原因,o(╯□╰)o

from hexo-auto-category.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.