优势: 部署方便, 第三方主体非常漂亮, 可以在git上直接运行生产网页(免费)
安装
首先需要本地安装npm , git(此处略过)
安装hexo
mkdir hexocd hexonpm install hexo-cli -ghexo init blogcd blognpm install-- 启动hexo server-----启动成功控制台会打印以下内容----INFO Hexo is running at http://localhost:4000 . Press Ctrl+C to stop.
将项目提交到git , 依次点击服务 -> gitee pages -> 选择分支 -> 部署
操作完成后就点击网站地址就可以看到我们的项目了
修改配置 blog/_config.yml
-- 一下为修改项 未修改的没有展示出来,请勿删除-- 博客基础信息title: blogsubtitle: yuyudescription: 个人博客keywords:author: yuyulanguage: zh-Hanstimezone: Asia/Shanghai# URL## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'url: https://reverselight.gitee.io/blog/root: /blog-- 此项为将主题设置Wie下面要讲到的next主题theme: hexo-theme-next-master
配置next主题
git链接
将下载下来的文件复制到 blog/themes/
修改 themes/hexo-theme-next-master/_config.yml
打开themes/next下的_config.yml文件
是否覆盖外部的全局设置
如果你要在主题里面设置建议这里设为true.
# Set to true, if you want to fully override the default configuration.# Useful if you don't want to inherit the theme _config.yml configurations.override: true
网页关键字和图标的设置
favicon:small: /images/favicon-16x16-next.pngmedium: /images/favicon-32x32-next.pngapple_touch_icon: /images/apple-touch-icon-next.pngsafari_pinned_tab: /images/logo.svg#android_manifest: /images/manifest.json#ms_browserconfig: /images/browserconfig.xml# Set default keywords (Use a comma to separate)keywords: "java, mysql,CSDN,git,gitee"
整个版面样式的设置
# Schemes# scheme: Muse# scheme: Mist# scheme: Piscesscheme: Gemini
社交平台
menu:home: / || hometags: /tags/ || tagscategories: /categories/ || tharchives: /archives/ || archive#schedule: /schedule/ || calendarabout: /about/ || usersitemap: /sitemap.xml || sitemap
设置链接
social:GitHub: https://gitee.com/reverseLight || githubE-Mail: yuy9501@126.com.com || envelope#Google: https://plus.google.com/yourname || google#Twitter: https://twitter.com/yourname || twitter#FB Page: https://www.facebook.com/yourname || facebook#VK Group: https://vk.com/yourname || vk#StackOverflow: https://stackoverflow.com/yourname || stack-overflow#YouTube: https://youtube.com/yourname || youtube#Instagram: https://instagram.com/yourname || instagram#Skype: skype:yourname?call|chat || skypeblog: http://www.chenguanting.top || stack-overflow
字数统计
# Post wordcount display settings# Dependencies: https://github.com/willin/hexo-wordcountpost_wordcount:item_text: truewordcount: truemin2read: truetotalcount: trueseparated_meta: true
设置打赏
#Rewardreward_comment: 您的支持是我创作源源不断的动力wechatpay: /images/reward_weixin.pngalipay: /images/reward_alipay.jpg#bitcoin: /images/logo_width.png
gitalk评论插件
# Gitalkgitalk:enable: true #用来做启用判断可以不用clientID: 'xxxxxxxx' #上面生成的往这里怼clientSecret: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx' #同上repo: xxxxx.github.com #仓库名称owner: xxxxxx #github用户名admin: xxxxxxxdistractionFreeMode: true
其他设置
next主题设置首页不显示全文(只显示预览)
修改 themes/hexo-theme-next-master/_config.yml
auto_excerpt:enable: truelength: 150
next主题设置文章目录
在此文件追加 themes/hexo-theme-next-master/source/css/_custom/custom.styl
//文章目录默认展开.post-toc .nav .nav-child { display: block; }// 文章目录字体大小调整.post-toc ol {font-size : 13px;}
修改 修改 themes/hexo-theme-next-master/_config.yml
toc:enable: true# Automatically add list number to toc.number: true# If true, all words will placed on next lines if header width longer then sidebar width.wrap: true
本地部署页面正常, git部署页面排版错乱
修改 themes/hexo-theme-next-master/_config.yml
url: https://reverselight.gitee.io/blog/root: /blog
