###需要的工具:node.js git hexo
###安装顺序
1、node.js
2、安装git
###安装heox
在git shell输入
cd /
npm install hexo-cli -g
###安装博客所需要的文件
cd /
hexo init hexo (这里是添加的一个文件,存放的是构建博客所要用到的所有的文件,这里的hexo是新建的文件名称)
cd hexo (然后进入这个文件下)
npm intal (安装依赖文件)
hexo g (编译 hexo generate)
hexo s (开启本地服务hexo sever)
###部署到服务器上
在库中找到_config.yml文件,在最后面添加上
deploy:
type: git
repo: https://github.com/nuocheng/nuocheng.github.io.git #这个是在GitHub中注册后得到的网址
branch: master
然后在git shell 中输入
hexo clean
hexo g -d
hexo s
如果在hexo g -d中出现错误的时候
在git sever 中输入
npm install hexo-deployer-git –save
###在博客中添加图片
首先在_config.yml文件中更改post_asset_folder:true
回到git shell,输入
npm install https://github.com/CodeFalling/hexo-asset-image –save
然后执行
hexo clean
hexo g -d
hexo s
然后重新创建一个博客的名字,然后发现Hexo\source_posts下多了一个与博客名字相同的空文件夹
然后就可以把我们博客中要用到的图片存放在这个文件夹下,需要时直接应用即可
/
在设置config.yml文件的时候,首先设置post_asset_folder: true
设置后当你新建一个页面后自动生成一个同名文件夹方便管理
hexo new page categories
hexo new page tags
**heox new page about
/
###安装主题:
下载地址:
https://github.com/iissnan/hexo-theme-next/releases
把下来的文件夹解压和更名为next,并复制到theme目录下
在根目录下的_config.yml 主要是对网站的总属性
找到theme 将其的值更改为next
###炫酷博客背景:
添加背景特效:
color:线条颜色,默认:’0,0,0’;三个数字分别为(R,G,B),注意用,分割
opacity:线条的透明度
count: 线条的总数量 默认为150
zIndex: 背景的z-index属性,css属性用于控制所在层的位置,默认:-1
添加修改代码:
next/layout/_layout.swig,在body标签之前添加如下代码:
{% if theme.canvas_nest %}
{% endif %}
打开next/_config.yml添加代码:
# Canvas-nest
canvas_nest: true
###添加categories
在你的根目录下,找到文件夹scaffolds,此文件下定义创建文章的基本模型,你可以修改此模板
实现每次进行HEXO NEW文章名,文章会以你的模板进行对应配置属性创建。
scaffolds 里面有三个文件分别对应草稿。页面。文章。建议都加上如下代码
title: hexo的建立
date: 1504615256000
tags:
categories: