I'm currently working on large language models at JD.
I love contributing to various open source projects. Here are some of my contributions:
Generate categories automatically for each post in Hexo
Home Page: https://blog.eson.org/pub/e2f6e239/
License: MIT License
I'm currently working on large language models at JD.
I love contributing to various open source projects. Here are some of my contributions:
假设在source_posts\AAA\aaa.md,修改AAA文件夹为BBB;aaa.md的内容会被清空,不知道该插件的是不是该插件的bug。
您好,按照您提供的设置方案,最后在hexo g
时有所有categories被替换为[]
的情况:
不论如何编辑front-matter,categories也都将被替换为categories: []
。我对hexo了解不多,请问您有什么看法吗?
以下是版本信息。
hexo: 7.1.1
hexo-cli: 4.3.1
os: win32 10.0.22631
node: 20.9.0
acorn: 8.10.0
ada: 2.6.0
ares: 1.19.1
base64: 0.5.0
brotli: 1.0.9
cjs_module_lexer: 1.2.2
cldr: 43.1
icu: 73.2
llhttp: 8.1.1
modules: 115
napi: 9
nghttp2: 1.57.0
nghttp3: 0.7.0
ngtcp2: 0.8.1
openssl: 3.0.10+quic
simdutf: 3.2.17
tz: 2023c
undici: 5.26.3
unicode: 15.0
uv: 1.46.0
uvwasi: 0.0.18
v8: 11.3.244.8-node.16
zlib: 1.2.13.1-motley
一篇博客的链接为:
http://localhost:4000/%E9%97%B2%E8%B0%88/helloworld/
(%E9%97%B2%E8%B0%88为闲谈,是我的一个category)
我希望链接为:
http://localhost:4000/helloworld/
已设置_config.yml:
permalink: :title/
permalink_defaults: :title/
仍然如此。
感谢!
通过 npm install 安装的好像是旧的版本
试用了一下,发现这个插件直接把所有文档的页头全部改了一遍。
包括date的格式、tags与categories的格式以及顺序,相当于整体格式化。
如果你是强迫症的话,这种格式化会非常烦人,我试用之前忘记备份原始文件,只好可怜的一个个再改回来。。。
可以使用hexo-directory-category
这个插件,它没有直接修改源文件。
请作者增加一个警告,告诉其他人,你的插件会修改MarkDown源文件,其中的风险起码应该告知用户。
在编译的时候,文章里categories分类会全部被清空,如果把插件关闭了以后会不会出现这个问题。
请问一下有没有什么解决办法。
INFO Generated: categories [[]] for post [高数文档.md]
INFO Generated: categories [[]] for post [考研计划:备考大纲-转载.md]
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
TypeError: tmpPost.categories.join is not a function
at Hexo.logic (C:\Users\Administrator\WebstormProjects\blog\node_modules\hexo-auto-category\lib\logic.js:33:55)
at Hexo.tryCatcher (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird\js\release\util.js:16:23)
at Hexo. (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird\js\release\method.js:15:34)
at C:\Users\Administrator\WebstormProjects\blog\node_modules\hexo\lib\extend\filter.js:61:50
at tryCatcher (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird\js\release\util.js:16:23)
at Object.gotValue (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird\js\release\reduce.js:166:18)
at Object.gotAccum (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird\js\release\reduce.js:155:25)
at Object.tryCatcher (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird\js\release
promise.js:547:31)
at Promise._settlePromise (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird\js\release\promise.js:
604:18)
at Promise._settlePromise0 (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird\js\release\promise.js
:649:10)
at Promise._settlePromises (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird\js\release\promise.js
:729:18)
at _drainQueueStep (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird\js\release\async.js:93:12)
at _drainQueue (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird\js\release\async.js:86:9)
at Async._drainQueues (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird\js\release\async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird
\js\release\async.js:15:14)
INFO Start processing
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
TypeError: tmpPost.categories.join is not a function
at Hexo.logic (C:\Users\Administrator\WebstormProjects\blog\node_modules\hexo-auto-category\lib\logic.js:33:55)
at Hexo.tryCatcher (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird\js\release\util.js:16:23)
at Hexo. (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird\js\release\method.js:15:34)
at C:\Users\Administrator\WebstormProjects\blog\node_modules\hexo\lib\extend\filter.js:61:50
at tryCatcher (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird\js\release\util.js:16:23)
at Object.gotValue (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird\js\release\reduce.js:166:18)
at Object.gotAccum (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird\js\release\reduce.js:155:25)
at Object.tryCatcher (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird\js\release
promise.js:547:31)
at Promise._settlePromise (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird\js\release\promise.js:
604:18)
at Promise._settlePromise0 (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird\js\release\promise.js
:649:10)
at Promise._settlePromises (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird\js\release\promise.js
:729:18)
at _drainQueueStep (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird\js\release\async.js:93:12)
at _drainQueue (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird\js\release\async.js:86:9)
at Async._drainQueues (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird\js\release\async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (C:\Users\Administrator\WebstormProjects\blog\node_modules\bluebird
\js\release\async.js:15:14)
这不是issue,由于此问题我亟待解决,所以我在这里请教下各位。
如果长时间没人回答,我会关掉此问题。
问题1
hexo new --path go/hello world "hello world"
将会在 source/_posts/go/
目录下生成 hello world.md
文件,并且标题为”hello world”。但是我想省略命令中的"hello world”, 让文件名自动生成标题该如何写呢?
问题2
hexo new --path go/hello world "hello world"
如分类层级较多,比如 编程语言/后端/go
,每次在go下创建md文件都要写全路径,这种方式比较影响效率,有没有像cd目录名称带提示的方法呢?
例如,当进行以下操作时,文件夹下所有的文章内容会被清空:
test11
。文件夹下有文章test.md
hexo clean && hexo g && hexo s
。test 11 22
。热更新后,重命名后的文件夹下所有的文章内容均被清空。日志:
INFO Generated: categories [[ 'test 11 22' ]] for post [test.md]
WARN Trying to "create" _posts/test 11 22/test.md, but the file already exists!
INFO No title found for post [source/_posts/test 11 22/test.md][ ]
INFO Generate link [0] for post [source/_posts/test 11 22/test.md][ ]
INFO Generated: categories [undefined] for post [source/_posts/test 11 22/test.md][ ]
INFO Generated: categories [[ 'test 11 22' ]] for post [test.md]
INFO No title found for post [source/_posts/test 11 22/test.md][ ]
INFO Generate link [0] for post [source/_posts/test 11 22/test.md][ ]
INFO Generated: categories [[ 'test 11 22' ]] for post [source/_posts/test 11 22/test.md][ ]
不知道是不是和文件名空格有关,尝试复现这个问题的时候只在某些情况下复现成功。最初发现这个 Bug 是 hexo s 执行后,我把名为 out of date
的文件夹,改为 OutOfDate
之后,OutOfDate
下的所有文章被清空。
使用hexo 6.2.0测试发现,本地启动后,直接更改文件夹名称,下面的所有文章内容丢失
On you're blog site you have page that displays all categorys how do I do that on my site, with the hexo theme https://probberechts.github.io/hexo-theme-cactus/cactus-dark/public/
var minDepth = this.config.auto_category.minDepth || 0;
...
tmpPost.categories = categories.slice(1+Math.min(minDepth, categories.length-2), 1+Math.min(depth, categories.length-2));
我在本地测试可以成功分类
但是通过Github Action自动部署时,却发现没有起作用。
通过log查看,已经运行改代码
INFO Generated: categories [life] for post [hello_world.md]
但是在输出文件中,没有category文件夹。
如果手动添加category则可以产生category文件夹。
Github action log for your refer:
https://github.com/liunaijie/liunaijie.github.io/actions/runs/6027436406/job/16352635372
click hexo deploy
to see the detail.
INFO Generated: categories [] for post [test]
INFO Generated: categories [] for post [Hello World]
INFO Generated: categories [] for post [test]
INFO Generated: categories [] for post [Hello World]
INFO Generated: categories [] for post [test]
INFO Generated: categories [] for post [Hello World]
INFO Generated: categories [] for post [test]
INFO Generated: categories [] for post [Hello World]
hexo g 成功,无重复打印
hexo s 重复打印上述内容,但 http://localhost:4000/ 可以访问预览
如果能在hexo new 的时候源文件也能归档就好了
Just like how to create this file source/_post/web/framework/hexo.md
with terminal?
FATAL {
err: TypeError: Cannot read property 'enable' of undefined
at Hexo.logic (D:\hexo\node_modules\hexo-auto-category\lib\logic.js:16:35)
at Hexo.tryCatcher (D:\hexo\node_modules\bluebird\js\release\util.js:16:23)
at Hexo. (D:\hexo\node_modules\bluebird\js\release\method.js:15:34)
at D:\hexo\node_modules\hexo\lib\extend\filter.js:67:52
at tryCatcher (D:\hexo\node_modules\bluebird\js\release\util.js:16:23)
at Object.gotValue (D:\hexo\node_modules\bluebird\js\release\reduce.js:166:18)
at Object.gotAccum (D:\hexo\node_modules\bluebird\js\release\reduce.js:155:25)
at Object.tryCatcher (D:\hexo\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (D:\hexo\node_modules\bluebird\js\release\promise.js:547:31)
at Promise._settlePromise (D:\hexo\node_modules\bluebird\js\release\promise.js:604:18)
at Promise._settlePromise0 (D:\hexo\node_modules\bluebird\js\release\promise.js:649:10)
at Promise._settlePromises (D:\hexo\node_modules\bluebird\js\release\promise.js:729:18)
at _drainQueueStep (D:\hexo\node_modules\bluebird\js\release\async.js:93:12)
at _drainQueue (D:\hexo\node_modules\bluebird\js\release\async.js:86:9)
at Async._drainQueues (D:\hexo\node_modules\bluebird\js\release\async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (D:\hexo\node_modules\bluebird\js\release\async.js:15:14)
at processImmediate (node:internal/timers:462:21)
} Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html
hexo g 时报错,卸载掉hexo-auto-category 就没事儿,所以应该还是它的问题,想问问该怎么办?
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html TypeError: tmpPost.categories.join is not a function at Hexo.logic (D:\hexo\blog\node_modules\hexo-auto-category\lib\logic.js:33:55) at Hexo.tryCatcher (D:\hexo\blog\node_modules\bluebird\js\release\util.js:16:23) at Hexo.<anonymous> (D:\hexo\blog\node_modules\bluebird\js\release\method.js:15:34) at Promise.each.filter (D:\hexo\blog\node_modules\hexo\lib\extend\filter.js:60:50) at tryCatcher (D:\hexo\blog\node_modules\bluebird\js\release\util.js:16:23) at Object.gotValue (D:\hexo\blog\node_modules\bluebird\js\release\reduce.js:155:18) at Object.gotAccum (D:\hexo\blog\node_modules\bluebird\js\release\reduce.js:144:25) at Object.tryCatcher (D:\hexo\blog\node_modules\bluebird\js\release\util.js:16:23) at Promise._settlePromiseFromHandler (D:\hexo\blog\node_modules\bluebird\js\release\promise.js:517:31) at Promise._settlePromise (D:\hexo\blog\node_modules\bluebird\js\release\promise.js:574:18) at Promise._settlePromise0 (D:\hexo\blog\node_modules\bluebird\js\release\promise.js:619:10) at Promise._settlePromises (D:\hexo\blog\node_modules\bluebird\js\release\promise.js:699:18) at _drainQueueStep (D:\hexo\blog\node_modules\bluebird\js\release\async.js:138:12) at _drainQueue (D:\hexo\blog\node_modules\bluebird\js\release\async.js:131:9) at Async._drainQueues (D:\hexo\blog\node_modules\bluebird\js\release\async.js:147:5) at Immediate.Async.drainQueues [as _onImmediate] (D:\hexo\blog\node_modules\bluebird\js\release\async.js:17:14) at runCallback (timers.js:705:18) at tryOnImmediate (timers.js:676:5) at processImmediate (timers.js:658:5)
详细描述:hexo 5.4.0中使用这个插件出现了不会自动生成分类文件夹的问题,不知是我步骤不对还是哪里错了。我尝试后用执行两次hexo g解决了这个问题,结合github action不需要手动执行。但具体原因还未知。详细过程如我博客文章:https://tazyu.xyz/post/986feafd/
npm安装还存在那个 err: TypeError: tmpPost.categories.join is not a function 的问题,翻了下issues才发现已经修复了
TODO
status header
[![Build Status](https://travis-ci.org/hexojs/hexo-server.svg?branch=master)](https://travis-ci.org/hexojs/hexo-server)
[![NPM version](https://badge.fury.io/js/hexo-server.svg)](http://badge.fury.io/js/hexo-server)
[![Coverage Status](https://img.shields.io/coveralls/hexojs/hexo-server.svg)](https://coveralls.io/r/hexojs/hexo-server?branch=master)
[![Build status](https://ci.appveyor.com/api/projects/status/ycbw8t7w3kjju0tv/branch/master?svg=true)](https://ci.appveyor.com/project/tommy351/hexo-server/branch/master)
我使用hexo s预览后,同时编辑md文件时,不时的显示文件已经修改,是否加载更新之类的对话框。
运行hexo g的时候提示tmpPost.categories.join is not a function,以下是输出,不懂js不会修,求助。
➜ BlogCollections hexo g && hexo s
INFO Validating config
INFO Start processing
FATAL {
err: TypeError: tmpPost.categories.join is not a function
at Hexo.logic (/Users/simon/Documents/BlogCollections/node_modules/hexo-auto-category/lib/logic.js:33:55)
at Hexo.tryCatcher (/Users/simon/Documents/BlogCollections/node_modules/bluebird/js/release/util.js:16:23)
at Hexo. (/Users/simon/Documents/BlogCollections/node_modules/bluebird/js/release/method.js:15:34)
at /Users/simon/Documents/BlogCollections/node_modules/hexo/lib/extend/filter.js:67:52
at tryCatcher (/Users/simon/Documents/BlogCollections/node_modules/bluebird/js/release/util.js:16:23)
at Object.gotValue (/Users/simon/Documents/BlogCollections/node_modules/bluebird/js/release/reduce.js:166:18)
at Object.gotAccum (/Users/simon/Documents/BlogCollections/node_modules/bluebird/js/release/reduce.js:155:25)
at Object.tryCatcher (/Users/simon/Documents/BlogCollections/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/simon/Documents/BlogCollections/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/Users/simon/Documents/BlogCollections/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/Users/simon/Documents/BlogCollections/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/Users/simon/Documents/BlogCollections/node_modules/bluebird/js/release/promise.js:729:18)
at _drainQueueStep (/Users/simon/Documents/BlogCollections/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/Users/simon/Documents/BlogCollections/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/Users/simon/Documents/BlogCollections/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/Users/simon/Documents/BlogCollections/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (internal/timers.js:461:21)
} Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html
_draft下的目录也生成了分类,使用hexo s
预览时,或是部署到github page上,都将_draft下的目录生成分类。
附:我使用的是0.1.5的最新版本。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.