hexo-joplin发布文章
目的
在joplin写文章,构建发布到静态网址上,支持搜索
env
- joplin-desktop (开启网页剪藏器)
- node-22 + hexo + hexo-theme-next
joplin-blog
hexo
1.nodejs
1.1 install nodejs
vmr search node
vmr use [email protected]
1.2 add hexo
npm install hexo-cli -g
全局安装hexo-cli (hexo)
2.download
2.1 clone joplin-hexo
blog-template
2.2 clone next themes
存放位置:
hexo-theme-next –> themes/next
3.modify
3.1 .joplin-blog.json
- baseurl
- token
注意tag:在joplin-server中,只有tag存在blog才会同步发布到hexo
3.2 delete package.json devDependencies
...
"joplin-blog": "workspace:*", //delete
....
3.3 .gitignore
# file
.DS_Store
db.json
.joplin-cache.json
# dir
node_modules/
public/
4.gen && run
4.1 add joplin-blog dependencies
npm i -D joplin-blog
or
npm install -D joplin-blog
4.2 generate from joplin-server by tag container blog
npm run gen
4.3 testing
npm install # 安装package.json中包
hexo server # 启动验证
4.4 view
首次需注册账户
5.optimized(优化)
5.1设置访问路径为/
package.json
"deploy": {
"type": "gh-pages",
"dist": "public",
"dest": "/" # 修改 blog/hexo -> /
},
_config.yml
# URL
url: http://127.0.0.1:4000/
root: /
5.2支持摘要即收缩
npm install hexo-excerpt --save
_config.yml
# hexo-excerpt(摘要显示 readmore)
excerpt:
depth: 4 #展示摘要多少
excerpt_excludes: []
more_excludes: []
hideWholePostExcerpts: true
5.3支持搜索
#search
- https://www.npmjs.com/package/hexo-generator-searchdb
- https://www.npmjs.com/package/hexo-generator-searchdb
npm install hexo-generator-searchdb
_config.yml
# search
search:
path: search.json
field: post
content: true
format: html
_config.next.yml
# Local search
# Dependencies: https://github.com/next-theme/hexo-generator-searchdb
local_search:
enable: true
# Show top n results per article, show all results by setting to -1
top_n_per_article: 1
# Unescape html strings to the readable one.
unescape: false
# Preload the search data when the page loads.
preload: false