优势: 部署方便, 第三方主体非常漂亮, 可以在git上直接运行生产网页(免费)

官方文档

安装

首先需要本地安装npm , git(此处略过)
安装hexo

  1. mkdir hexo
  2. cd hexo
  3. npm install hexo-cli -g
  4. hexo init blog
  5. cd blog
  6. npm install
  7. -- 启动
  8. hexo server
  9. -----启动成功控制台会打印以下内容----
  10. INFO Hexo is running at http://localhost:4000 . Press Ctrl+C to stop.

将项目提交到git , 依次点击服务 -> gitee pages -> 选择分支 -> 部署
image.png
操作完成后就点击网站地址就可以看到我们的项目了


修改配置 blog/_config.yml

  1. -- 一下为修改项 未修改的没有展示出来,请勿删除
  2. -- 博客基础信息
  3. title: blog
  4. subtitle: yuyu
  5. description: 个人博客
  6. keywords:
  7. author: yuyu
  8. language: zh-Hans
  9. timezone: Asia/Shanghai
  10. # URL
  11. ## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
  12. url: https://reverselight.gitee.io/blog/
  13. root: /blog
  14. -- 此项为将主题设置Wie下面要讲到的next主题
  15. theme: hexo-theme-next-master

配置next主题

git链接
将下载下来的文件复制到 blog/themes/
修改 themes/hexo-theme-next-master/_config.yml
打开themes/next下的_config.yml文件

是否覆盖外部的全局设置

如果你要在主题里面设置建议这里设为true.

  1. # Set to true, if you want to fully override the default configuration.
  2. # Useful if you don't want to inherit the theme _config.yml configurations.
  3. override: true

网页关键字和图标的设置

  1. favicon:
  2. small: /images/favicon-16x16-next.png
  3. medium: /images/favicon-32x32-next.png
  4. apple_touch_icon: /images/apple-touch-icon-next.png
  5. safari_pinned_tab: /images/logo.svg
  6. #android_manifest: /images/manifest.json
  7. #ms_browserconfig: /images/browserconfig.xml
  8. # Set default keywords (Use a comma to separate)
  9. keywords: "java, mysql,CSDN,git,gitee"

整个版面样式的设置

  1. # Schemes
  2. # scheme: Muse
  3. # scheme: Mist
  4. # scheme: Pisces
  5. scheme: Gemini

社交平台

  1. menu:
  2. home: / || home
  3. tags: /tags/ || tags
  4. categories: /categories/ || th
  5. archives: /archives/ || archive
  6. #schedule: /schedule/ || calendar
  7. about: /about/ || user
  8. sitemap: /sitemap.xml || sitemap

设置链接

  1. social:
  2. GitHub: https://gitee.com/reverseLight || github
  3. E-Mail: yuy9501@126.com.com || envelope
  4. #Google: https://plus.google.com/yourname || google
  5. #Twitter: https://twitter.com/yourname || twitter
  6. #FB Page: https://www.facebook.com/yourname || facebook
  7. #VK Group: https://vk.com/yourname || vk
  8. #StackOverflow: https://stackoverflow.com/yourname || stack-overflow
  9. #YouTube: https://youtube.com/yourname || youtube
  10. #Instagram: https://instagram.com/yourname || instagram
  11. #Skype: skype:yourname?call|chat || skype
  12. blog: http://www.chenguanting.top || stack-overflow

字数统计

  1. # Post wordcount display settings
  2. # Dependencies: https://github.com/willin/hexo-wordcount
  3. post_wordcount:
  4. item_text: true
  5. wordcount: true
  6. min2read: true
  7. totalcount: true
  8. separated_meta: true

设置打赏

  1. #Reward
  2. reward_comment: 您的支持是我创作源源不断的动力
  3. wechatpay: /images/reward_weixin.png
  4. alipay: /images/reward_alipay.jpg
  5. #bitcoin: /images/logo_width.png

gitalk评论插件

  1. # Gitalk
  2. gitalk:
  3. enable: true #用来做启用判断可以不用
  4. clientID: 'xxxxxxxx' #上面生成的往这里怼
  5. clientSecret: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx' #同上
  6. repo: xxxxx.github.com #仓库名称
  7. owner: xxxxxx #github用户名
  8. admin: xxxxxxx
  9. distractionFreeMode: true

其他设置

next主题设置首页不显示全文(只显示预览)

修改 themes/hexo-theme-next-master/_config.yml

  1. auto_excerpt:
  2. enable: true
  3. length: 150

next主题设置文章目录

在此文件追加 themes/hexo-theme-next-master/source/css/_custom/custom.styl

  1. //文章目录默认展开
  2. .post-toc .nav .nav-child { display: block; }
  3. // 文章目录字体大小调整
  4. .post-toc ol {
  5. font-size : 13px;
  6. }

修改 修改 themes/hexo-theme-next-master/_config.yml

  1. toc:
  2. enable: true
  3. # Automatically add list number to toc.
  4. number: true
  5. # If true, all words will placed on next lines if header width longer then sidebar width.
  6. wrap: true

本地部署页面正常, git部署页面排版错乱

修改 themes/hexo-theme-next-master/_config.yml

  1. url: https://reverselight.gitee.io/blog/
  2. root: /blog