windows部署hexo
Tanwan

Windows本地 Hexo 安装与 Indigo 主题配置指南

前提条件

Hexo 安装简单易行。在安装前,请确保已安装以下程序:

若已安装上述工具,即可继续使用 npm 完成 Hexo 的安装。


安装 Hexo 主程序

进入你希望安装 Hexo 的目录(示例为 D 盘):

1
cd D:/Hexo

然后依次执行以下命令:

1
2
3
4
5
6
7
8
9
10
11
12
npm install -g hexo-cli
hexo init
npm i hexo@4.2.1
npm install

npm uninstall hexo-renderer-marked --save
npm install hexo-renderer-kramed --save
npm install hexo-deployer-git --save
npm install hexo-generator-feed --save
npm install hexo-generator-json-content --save
npm install hexo-renderer-less --save
npm install hexo-admin --save

启动 Hexo 测试

1
hexo clean && hexo g && hexo s

浏览器访问:

1
http://localhost:4000

若页面显示 “Hello world”,说明安装成功!


Hexo 常用指令

命令 说明
hexo new title 创建新文章
hexo g 生成网站内容
hexo s 启动本地服务器
hexo clean 清除缓存文件
hexo d 提交到远程服务器(需绑定)

安装 Indigo 主题

参考项目:

克隆主题到 Hexo 的 themes 目录下:

1
git clone https://github.com/tanwanme/indigo.git themes/indigo

修改 Hexo 配置文件

进入 Hexo 根目录(如:D:/Hexo/),编辑 _config.yml 文件,添加如下配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
title: 皓月当空云归隐
subtitle: 我站在阳台抽烟,我抽一半,风抽一半。
description: '记录我自己折腾过程.'
keywords: hexo,indigo
author: Tanwan
language: zh_CN
timezone: 'Asia/Shanghai'

url: https://kzdd.us.kg

theme: indigo

jsonContent:
meta: false
pages: false

posts:
title: true
date: true
path: true
text: true
raw: false
content: false
slug: false
updated: false
comments: false
link: false
permalink: false
excerpt: false
categories: false
tags: true

feed:
type: atom
path: atom.xml
limit: 0

构建新网站内容

1
hexo clean && hexo g && hexo s

浏览器访问:

1
http://localhost:4000

确认页面更新成功。


Markdown 编辑器推荐

推荐使用一款简洁清爽的 Markdown 编辑器: