Hexo博客搭建流程

博客搭建步骤

安装 hexo

npm install hexo -g

hexo 常用指令

hexo clean # 清空hexo,主要删除Hexo根目录下的public文件夹
hexo g # 重新成功public文件夹内容
hexo s # 启动本地hexo服务
hexo d # 发布到远程仓库

初始化 hexo

hexo init

安装 deploter-git 插件

npm install hexo-deployer-git

Hexo 发布到 github 的时候,会丢失 reanme 和 CNAME

npm install hexo-generator-cname

安装主题 Butterfly

官方网站

在博客根目录安装主题

git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/Butterfly

安装 cheerio

npm install cheerio@0.22.0 --save

安装渲染器

npm install hexo-renderer-pug hexo-renderer-stylus

修改 hexo 配置文件_config.yml,把主题改为Butterfly

theme: Butterfly

其余配置请参考主题的配置文档

常用插件

本地搜索

安装插件

npm install hexo-generator-search --save

此_config.yml配置插件

search:
  path: search.xml
  field: post
  content: true

文章顶置

npm uninstall hexo-generator-index --save
npm install hexo-generator-index-pin-top --save
---
top: True
---

note 标签

<div class="note default"><p>default</p></div>

default

“`html

primary

“`

primary

<div class="note success"><p>success</p></div>

success

<div class="note info"><p>info</p></div> 

info

<div class="note warning"><p>warning</p></div> 

warning

<div class="note danger"><p>danger</p></div>

danger

 

RSS

安装插件

npm install hexo-generator-feed --save

添加萌宠

npm install hexo-helper-live2d --save
# 参考文章:https://vonsdite.cn/posts/fbd1f97f.html

安装 sitmap 插件

npm install hexo-generator-sitemap --save
npm install hexo-generator-baidu-sitemap --save

卸载 hexo

npm uninstall hexo

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注