8.语雀文档同步到 hexo


1.去官网注册账号

点我去官网

2.创建知识库

image.png

3.点击当前知识库的设置

获取当前知识库的登录名和路径
image.png

4.在将语雀文档同步到 hexo

//先安装 yuque-hexo
npm i -g yuque-hexo

1) 修改 package.json,增加配置:

"yuqueConfig": {
    "postPath": "source/_posts/yuque",
    "cachePath": "yuque.json",
    "mdNameFormat": "title",
    "adapter": "hexo",
    "concurrency": 5,
    "baseUrl": "https://www.yuque.com/api/v2",
    "login": "leader755",
    "repo": "blog",
    "token": "在语雀上申请的 token",
    "onlyPublished": false,
    "onlyPublic": false
  },
参数名 含义 默认值
postPath 文档同步后生成的路径 source/_posts/yuque
cachePath 文档下载缓存文件 yuque.json
mdNameFormat 文件名命名方式 (title / slug) title
adapter 文档生成格式 (hexo/markdown) hexo
concurrency 下载文章并发数 5
baseUrl 语雀 API 地址 -
login 语雀 login (group), 也称为个人路径 -
repo 语雀仓库短名称,也称为语雀知识库路径 -
onlyPublished 只展示已经发布的文章 false
onlyPublic 只展示公开文章 false

slug 是语雀的永久链接名,一般是几个随机字母。

2)在 package.json 添加 scripts

//添加以下命令行
{
  "sync": "yuque-hexo sync",
  "clean:yuque": "yuque-hexo clean"
}

目前为止 scripts 命令行为

"scripts": {
    "build": "hexo generate",
    "clean": "hexo clean",
    "deploy": "hexo deploy",
    "server": "hexo server",
    "sync": "yuque-hexo sync",
    "clean:yuque": "yuque-hexo clean"
  },

3)关于在语雀上申请 token

点击账户个人–>设置 –>Token–>新建 token

5.同步语雀文档到本地 hexo

//同步文档
yuque-hexo sync

//清除本地缓存
yuque-hexo clean

文章作者:   leader755
版权声明:   本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 leader755 !
评论
 上一篇
travis-ci + github + hexo 持续集成 travis-ci + github + hexo 持续集成
Hexo 博客源代码 GitHub 托管1.注册 travis-ciTravis CI 的网站有两个,travis-ci.org 专门针对开源项目,GitHub 上所有的公开仓库都能够免费使用;travis-ci.com 针对私有及商业
2020-07-20
下一篇 
hexo博客站内搜索功能 hexo博客站内搜索功能
1.根目录安装插件 hexo-generator-searchdbnpm install hexo-generator-searchdb --save 2.配置根目录文件_config.ymlsearch: path: search.xml
2020-07-18
  目录