Comments (2)
这个功能尚未实现,可以 MR 提供一下~
from yuque-hexo.
这是加入categories front-matter的关键代码,目前hexo本身并没有显示目录的功能。我认为这不是本插件能解决的。
第73行改成这样:const { config, client, toc, _cachedArticles } = this;
lib\Downloader.js 77行插入以下代码(写得丑,自己优化一下)
if (config.autoFrontMatter) { // 自己在package.js添加配置项
let categories = new Array();
const getCategories = function (toc, item) { // 根据toc生成categories
for (let i = 0; i < toc.length; i++) {
if (toc[i].uuid === item.parent_uuid) {
categories.push(toc[i].title);
if (!!toc[i].parent_uuid) {
getCategories(toc, toc[i]);
} else {
break;
}
}
}
}
for (let i = 0; i < toc.length; i++) { // 取得文章对应知识库的目标项
if (toc[i].type === 'DOC' && toc[i].id == article.id) {
getCategories(toc, toc[i]);
}
}
const str_categories = categories.length < 1 ? '' : `categories:\n- ${categories.length > 1 ? '[' + categories.join(',') + ']' : categories[0]}\n`;
const front_matter = `---\ntitle: ${article.title}\ndate: ${article.created_at}\nupdated: ${article
.updated_at}\n${str_categories}---\n`;
article.body = front_matter + article.body;
}
from yuque-hexo.
Related Issues (20)
- 上传七牛云图床部分图片上次失败,无法准确定位到具体问题 HOT 1
- 用七牛云上传图片,但是图片损坏了,不知道那里出问题了 HOT 7
- 可以自动上传到又拍云 图床么 HOT 2
- 语雀图片转换失败 HOT 3
- 教程描述有待提升 HOT 5
- 请求添加自动分组功能 HOT 2
- 建议同步语雀文档的修改时间 HOT 4
- github actions的lastGeneratePath.log问题 HOT 6
- 最近发现自动上传到图床的图片大小都不正确,无法正常显示怎么排查? HOT 4
- 发现隔一段时间(一到两周)就部署失败,重置了yuque_token后正常 HOT 3
- 关于 adpater (hexo) is invalid. 的问题 HOT 11
- 自定义 front-matter 异常
- 语雀分享要会员了,可以出一个飞书的吗
- 是否可以保留hexo写博客的能力? HOT 2
- 图片替换失败
- yuque-hexo相关逻辑 HOT 1
- [WARNING] 检查图片信息时出错
- 现在没有会员咋设置token HOT 2
- 增加下载文件到 source/images 目录的支持 HOT 4
- use slug as permant_link title HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yuque-hexo.