-
-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
这个cache是不是应该放在if的外面,不然有可能和历史的文章重复? #76
Comments
没太看明白😂,大佬可以举个例子吗 |
@yqs112358 let generateAbbrlink = function (data) {
...
...
// calc abbrlinks
if (!abbrlink || abbrlink == '0' || config.force) {
...
...
model.cacheNewPostAbbrlink(data.source, abbrlink) // 如果是新文章,缓存到new_cache
} else {
model.cacheOldPostAbbrlink(data.source, abbrlink) // 旧文档,缓存到old_cache
}
}
let writebackToFiles = function (data) {
...
...
// avoid rewrite front-matter if the same abbrlink exists
let abbrlink = model.getNewPostAbbrlink(data.source)
if(!abbrlink)
return data;
// 新文章时,判断旧文档中是否已经有相同的link,如果有就再生成直到不重复
abbrlink = model.uniqueAbbrlinkByOldCache(abbrlink);
...
...
} |
喔,这边确实疏忽了,我看着改一下,感谢兄弟👍 |
hexojs/hexo#5583 我的想法是,尽量在 |
我也不太熟悉这个流程,看了filter的文档,感觉写的模棱两可。 |
确实哈,我看一下 |
@Asutorufa |
merged |
hexo-abbrlink/lib/logic.js
Line 61 in 70f112b
感觉是需要old_cache和new_cache分开,然后在写入文件前再判断下old_cache中有没有。
The text was updated successfully, but these errors were encountered: