Hexo 搭建 Blog 精简笔记

安装Hexo

npm install -g hexo-cli

Mac 用户
您在编译时可能会遇到问题,请先到 App Store 安装 Xcode,Xcode 完成后,启动并进入 Preferences -> Download -> Command Line Tools -> Install 安装命令行工具。

创建博客文件夹:

hexo init MyBlog
cd MyBlog
npm install

使用Next主题

NexT 扩展都安装在themes/next/source/lib文件夹下

cd MyBlog
git clone https://github.com/theme-next/hexo-theme-next themes/next

站点配置文件_config.yml

theme: next # 启用next主题

指令

hexo new <title> # 创建新文章
hexo g/generate # 生成静态文件
hexo clean # 清除缓存文件和已生成的静态文件(public)
hexo server # 启动本地服务器
hexo d/deploy # 部署网站
hexo list <type> # 列出网站资料
hexo version # 显示hexo版本

SEO优化

FAQ

Q1:如何升级hexo

简单修改一下 package.json,然后执行npm install --save。参考将 Hexo 升级到 v3.5.0

npm update hexo-cli -g

Q2:如何升级 next 主题?

You can update to latest master branch by the following command:

$ cd themes/next
$ git pull

参考

Q3:npm常用指令

npm install 模块名 -g --save # g全局安装 save安装包信息将加入到dependencies(生产阶段的依赖)
npm install [email protected] # 指定版本
npm install # 该命令可以根据dependencies配置安装所有的依赖包
npm update [-g] 模块名
npm outdated 模块名 # 检查模块是否过时
npm ls -g # 查看全局安装的模块
npm uninstall 模块名
npm info hexo-cli # 查看hexo-cli模块的信息

最后

博客建完的地址:https://michael728.github.io/

参考

猜你喜欢

转载自www.cnblogs.com/michael-xiang/p/10464518.html