Git
和Node
hexo
GitHub
,建立一个仓库,库名格式为:GitHub用户名.github.io
Git
Node
hexo
//安装hexo
&:npm install hexo-cli -g //建立本地博客,“GitHub用户名.github.io”建议和GieHub仓库名一致 hexo init GitHub用户名.github.io 例如: &:hexo init 1170197998.github.io //进入到安装目录 &:cd 1170197998.github.io/ //安装npm &:npm install //启动服务 &;hexo server
npm install hexo-server --save npm install hexo --save
1170197998.github.io
的仓库,1170197998.github.io
中的_config.yml
,加入仓库地址,以下:deploy: type: git repo: https://github.com/1170197998/1170197998.github.io.git branch: master
public
文件夹),部署服务//生成静态文件 &:hexo generate //部署服务 &:hexo deploy
1170197998.github.io
能够访问博客
github
空间服务IP
:ping 1170197998.github.io
source
文件下新建一个文件名为CNAME
文件,不要有后缀,输入域名,保存关闭hexo g
,hexo d
进行生成和部署。此时在浏览地址栏键入域名就能够打开博客了themes
文件夹下,默认landscape
主题,想切换别的主题,终端进入到该文件夹下,进行克隆便可,好比克隆next主题:&:git clone https://github.com/iissnan/hexo-theme-next themes/next
_config.yml
中把theme
的值由默认的landscape
修改成next
。hexo g
,hexo d
进行生成和部署命令。此时再登陆域名,主题已经切换。1170197998.github.io
,网页加载完后会变为url
的值,而后执行hexo g
,hexo d
进行生成和部署命令。npm install hexo -g #安装 npm update hexo -g #升级 hexo init #初始化 简写 hexo n "个人博客" == hexo new "个人博客" #新建文章 hexo p == hexo publish hexo g == hexo generate#生成 hexo s == hexo server #启动服务预览 hexo d == hexo deploy#部署 服务器 hexo server 会监视文件变更并自动更新,无须重启服务器。 hexo server -s #静态模式 hexo server -p 5000 #更改端口 hexo server -i 192.168.1.1 #自定义 IP hexo clean #清除缓存 网页正常状况下能够忽略此条命令,清除了db_json文件和public文件夹 hexo g #生成静态网页 hexo d #开始部署 监视文件变更 hexo generate #使用 Hexo 生成静态文件快速并且简单 hexo generate --watch #监视文件变更 完成后部署 hexo generate --deploy hexo deploy --generate or: hexo deploy -g hexo server -g 草稿 hexo publish [layout] <title>
FATAL Cannot find module '/Users/xxxxxxx/GitHubBlog/1170197998.github.io/node_modules/hexo-renderer-marked' Error: Cannot find module '/Users/xxxxxxx/GitHubBlog/1170197998.github.io/node_modules/hexo-renderer-marked' at Function.Module._resolveFilename (module.js:485:15) at Function.resolve (internal/module.js:18:19)
npm install
,执行以下命令:&:rm -rf node_modules
&:npm install
先执行:
npm install hexo-deployer-git --save 而后执行: hexo g hexo d
在文章的顶部tags和categories中这样写所属分类和对应的标签,例如:css
tags: [iOS,链式编程和函数式编程] categories: [iOS_Objective-C] 备注:单个分类或者标签不须要用中括号[],多个的时候用[]括起来,英文逗号隔开。
使用的是Local Search
, 首先安装hexo-generator-searchdb
<要在当前博客目录下>html
npm install hexo-generator-searchdb --save
而后在博客目录下的_config.xml
里面加入如下字段node
search:
path: search.xml
field: post format: html limit: 10000
同时要把主题目录下的_config.xml
文件中的local_search
的enable
设置为truegit
local_search:
enable: true
注册登陆百度统计,把统计脚本id复制到主题next
下的配置文件_config.xml
中的baidu_analytics
字段后
github
注册登陆网易云跟帖,将yunTieProductKey
放到主题next
下的配置文件_config.xml
中的gentie_productKey
字段后
npm