Hexo 和 stellar

Hexo 是一个快速、简洁且高效的博客框架。。
stellar 是一个内置文档系统的简约商务风 Hexo 主题,支持丰富的标签和动态数据组件。

安装Hexo

前置条件

安装 Hexo 前需要先安装下列应用程序:
·Node.js (建议使用 Node.js 16.0 及以上版本)
·Git

Windows上安装Git和Node.js

1.安装Git

官网下载并安装 Git
验证安装是否成功:

PowerShell / CMD
1
git -v

2.安装Node.js

官网下载并安装 Node.js LTS 版本
验证安装是否成功:

PowerShell / CMD
1
2
node -v
npm -v

Linux (Ubuntu, Debian)安装git和node.js

1.安装Git

1
sudo apt-get install git-core

验证安装是否成功:

1
git -v

2.安装Node.js

添加 NodeSource 源(以 Node.js 20 LTS 为例 )

1
2
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs

验证安装是否成功:

1
2
node -v
npm -v

安装Hexo并配置Stellar主题

1.安装Hexo

PowerShell / CMD / Linux终端
1
npm install -g hexo-cli  

验证安装是否成功:

PowerShell / CMD / Linux终端
1
hexo v

2.生成hexo文件

PowerShell / CMD / Linux终端
1
2
3
hexo init blog  
cd blog
npm install

3.安装Stellar主题(稳定版)

npm安装不能更改源码,需要自定义布局、样式的可以往下翻安装最新版
打开终端并进入博客文件夹执行:

PowerShell / CMD / Linux终端
1
npm i hexo-theme-stellar  

4.修改主题为stellar

_config.yml
1
theme: stellar

5.创建主题配置文件:

Windows下手动复制node_modules\hexo-theme-stellar\_config.yml文件到博客根目录下,并重命名为_config.stellar.yml

Linux终端
1
cp node_modules/hexo-theme-stellar/_config.yml _config.stellar.yml

6.git submodule安装最新版

把 Stellar 主题仓库添加为博客仓库的子模块

\blog
1
2
git init
git submodule add https://github.com/xaoxuu/hexo-theme-stellar.git themes/stellar
_config.yml
1
theme: stellar

Windows下手动复制themes\stellar\_config.yml文件到博客根目录下,并重命名为_config.stellar.yml

Linux终端
1
cp themes/stellar/_config.yml _config.stellar.yml