前言
环境准备
git
2、双击exe文件安装,一路next即可。
3、安装好git之后,配置用户名和邮箱
git config --global user.name "voidking"
nvm
2、解压nvm-noinstall.zip到D:\develop\nvm
目录。
3、双击install.cmd,生成settings.txt文件。打开settings.txt文件,添加:
node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/
4、右键此电脑,属性,高级系统设置,环境变量。
5、系统变量中,添加JVM_HOME
为D:\develop\nvm
;添加JVM_SYMLINK
为D:\develop\nvm\nodejs
;Path
中添加;%NVM_HOME%;%NVM_SYMLINK%;
。
6、用户变量中,添加JVM_HOME
为D:\develop\nvm
;添加JVM_SYMLINK
为D:\develop\nvm\nodejs
;Path
中添加;%NVM_HOME%;%NVM_SYMLINK%;
。
node
1、查看可获得的node版本
nvm list available
2、安装node8.11.1
nvm install 8.11.1
2、使用node8.11.1
nvm list
nvm install 8.11.1
3、测试使用
node -v
安装hexo
2、安装hexo
npm install -g hexo
3、初始化
新建hexo目录,并安装依赖包。
hexo init hexo
cd hexo
npm install
个性化
添加RSS
npm install hexo-generator-feed --save
,
注意,后面的参数--save
绝对不能省,否则该插件信息不会写入package.json。
hexo clean
,hexo g
,查看public文件夹,可以看到atom.xml文件。
添加sitemap
npm install hexo-generator-sitemap --save
npm install hexo-generator-baidu-sitemap --save
主题
config.yml
hexo目录中的_config.yml修改为:
# Hexo Configuration
## Docs: http://hexo.io/docs/configuration.html
## Source:
# Site
title: VoidKing
subtitle: 学而不思则罔,思而不学则殆!
description: VoidKing
author: VoidKing
language: zh-CN
timezone:
# URL
## If your site is put in a subdirectory, set url as and root as '/child/'
url:
root: /
permalink: :year/:month/:day/:title/
permalink_defaults:
# Directory
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:
# Writing
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link: true # Open external links in new tab
filename_case: 0
render_drafts: false
post_asset_folder: false
relative_link: false
future: true
highlight:
enable: true
line_number: true
auto_detect: true
tab_replace:
# Category & Tag
default_category: uncategorized
category_map:
tag_map:
# Date / Time format
## Hexo uses Moment.js to parse and display date
## You can customize the date format as defined in
##
date_format: YYYY-MM-DD
time_format: HH:mm:ss
# Pagination
## Set per_page to 0 to disable pagination
per_page: 5
pagination_dir: page
index_generator:
per_page: 5
archive_generator:
per_page: 500
yearly: true
monthly: true
tag_generator:
per_page: 100
category_generator:
per_page: 100
# Extensions
## Plugins: http://hexo.io/plugins/
## Themes: http://hexo.io/themes/
theme: yilia
# Deployment
## Docs: http://hexo.io/docs/deployment.html
deploy:
type: git
repository:
branch: coding-pages
## gitcafe
### deploy:
### type: git
### repository:
### branch: gitcafe-pages
## github
### deploy:
### type: git
### repository:
### branch: coding-pages
mathjax
发布
coding
2、新建一个项目,和帐号名相同。
3、项目启动Pages服务。
本地操作
1、生成本地代码
hexo g
3、发布到coding
hexo d
提示ERROR Deployer not found: git,需要先执行:
npm install hexo-deployer-git --save
域名
1、申请域名。
2、域名解析添加CNAME记录指向voidking.coding.me
。
3、在coding上绑定域名。
4、测试访问。
后记
至此,hexo安装部署完成。有些步骤写的比较简单,不理解的可以自行谷歌百度。