基于Github Page 搭建博客(hexo框架)

git源码
Demo: www.kunlingou.clubhtml

搭建

初始博客环境

cnpm i -g hexo-cli
hexo init
cnpm install
复制代码

配置博客参数

./_config.yml

//部署(提交)模式
# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
 type: git
 repo: git@github.com:kunlingou/kunlingou.github.io.git
 branch: master

hexo s //启动服务
复制代码

部署(提交到git)

cnpm i -S hexo-deployer-git
hexo clean
hexo g -d //生成后部署hexo generate  hexo deploy 
复制代码

关联域名

./source/CNAME

www.kunlingou.club
复制代码
  • 部署服务

问题

  1. 没法访问googleapis相关连接jquery.min.js
    .\themes\landscape\layout\_partial\after-footer.ejs
    ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js替换为libs.baidu.com/jquery/2.0.3/jquery.min.js
hexo clean
hexo g -d
复制代码
  1. 主题(NexT)
    参考文档:官方文档
./

git clone https://github.com/theme-next/hexo-theme-next themes/next

./_config.yml

# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
# theme: landscape
theme: next
复制代码
  • next
    git clone https://github.com/theme-next/hexo-theme-next themes/next

  • replica
    git clone git@github.com:sabrinaluo/hexo-theme-replica.git themes/replica

使用

hexo经常使用命令

hexo n "XXX"//新建文章
hexo g -d //生成静态文件,生成后部署
hexo s //启动本地服务器
hexo clean //清除缓存文件db.json和生成文件./public/
复制代码

option

hexo --safe //安全模式
hexo --debug //调试模式
hexo --silent //静默模式
复制代码
相关文章
相关标签/搜索