美文网首页
简书迁移到Hexo

简书迁移到Hexo

作者: 陈桐Caliburn | 来源:发表于2020-05-26 12:07 被阅读0次

1、简书数据md文档下载

头像->设置->账号管理->下载所有文章


image.png

2、迁移简书文章

需要在简书md文章,增加头部信息
eg:

---
title: 感谢老婆大人
date: 2019-05-30 16:50:53
tags:
---

执行jianshu.sh,为每篇文章增加分类

time=`date "+%Y-%m-%d %H:%M:%S"`

for f in ./*/*;do
  base=$(basename $f .md)
  categories=$(basename $(dirname $f) $PWD)
  insert="---\ntitle: ${base}\ndate: ${time}\ncategories:\n- ${categories}\n---\n"
  echo  "${insert}$(cat $f)" > $f
done

将文章拷贝到hexo/source/_posts中

解决模板错误

Template render error: (unknown path)
校验md文件错误

md文件名字出现 '[]' 报错
md文件内容直接出现"{{","}}"报错

校验shell ,check.sh

#内容不能直接有{{
#find ./source -name "*.md" | xargs  grep '{{'
# 解决 xargs: unterminated quote 问题
find ./source -name "*.md" -print0 | xargs -0  grep "{{"

#标题不能有 []
find ./source -name "*.md" |   grep "\["
find ./source -name "*.md" |   grep "\]"

启动hexo

hexo clean #清理文件
hexo s        #生成文件
hexo deploy  #部署
hexo  g d  #//部署并发布

备注 Mac 按照端口杀进程
lsof -i :port
kill -9 pid

实战代码

hexo代码
https://github.com/yinlingchaoliu/hexo

github.io空间
https://yinlingchaoliu.github.io

后续hexo博客优化目标
https://www.simon96.online/2018/10/12/hexo-tutorial/

相关文章

网友评论

      本文标题:简书迁移到Hexo

      本文链接:https://www.haomeiwen.com/subject/slrmahtx.html