hexo搭建博客

安装环境

日常运行

  • 清理 hexo clean

  • 生成静态页面 hexo generate —> hexo g

  • 新建页面 hexo new “postname” —> hexo n

  • 启动服务 hexo server —> hexo s

  • 部署: hexo deploy —> hexo g —> hexo s -g

    #安装git支持
    npm install hexo-deployer-git --save
    
    # _config.yml文件中修改
    deploy:
      type: github
      repository: git@github.com:zhchnchn/zhchnchn.github.io.git
      branch: master
    

配置评论

一般主题中已经自带了多说等评论插件,只要标记自己的duoshuoID即可,例如已经使用了

duoshuo_shortname: bondlee

fancybox: true

google_analytics:

配置主题

网上有很多主题可以选择,找到后复制到theme下的文件夹中,再到_config.yml中配置即可:

# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: landfarz

安装rss订阅功能

首先安装
npm install hexo-generator-feed

向Google 搜索引擎提交站点

注册并验证

打开验证:https://www.google.com/webmasters/verification/home?hl=cn,用Google账户登录
添加站点地址,选择验证方法:
HTML file upload(HTML文件上传)
通用的方法,下载文件,直接放在yourblog/themes/next/source/下并重新生成提交即可。

提交sitemap

安装插件生成sitemap
npm install hexo-generator-sitemap –save
_config.yml
sitemap:
path: sitemap.xml
提交生成的file,可以在浏览器中打开”abc.com/sitemap.xml”看一下

提交给Google

打开https://www.google.com/webmasters/tools/home?hl=zh-CN
Sitemap(站点地图)->Add->填写url,提交

参考文献

http://www.cnblogs.com/zhcncn/p/4097881.html

https://hexo.io/zh-cn/docs/setup.html