Tools

Hexo

Hexo 博客的创建、更新、源文件备份与多设备写作流程

参考资料:

  1. 从零开始搭建 Hexo 博客简明教程(2024 版)
  2. Butterfly

博客更新

hexo new "my first passage" # 创建新文章
hexo clean # 清空静态网页 cache,然后 hexo d 重新生成
hexo g # hexo generate,根据源文件生成静态网页
hexo s # hexo server,本地部署测试,预览博客效果
hexo d # hexo deploy,发布推送到 GitHub Pages

源文件备份

git remote add origin https://github.com/jrxiang/jrxiang.github.io.git
git add .
git commit -m "update source"
git checkout -b source # 若 source 分支已存在则不用-b
git push -u origin source:source

用不同电脑写博客

npm install -g hexo-cli # 安装 hexo 框架
git clone https://github.com/jrxiang/jrxiang.github.io.git
git pull
git checkout source

插入图片

创建新文章时会自动在_posts/下生成与之同名的文件夹,其中可存放文中用到的图片。例如,文中需要用到名为picture.jpg的图片,则直接在文中按如下方式引用即可(注:“标题”可省略)。

![图片](picture.jpg "标题")

Search posts

    ↑ ↓ select · Enter open ·Esc or click outside to close