hexo博客配置

部署到自己的服務器

安裝hexo-deployer-rsync部署工具,需要遠程主機開啓22端口

npm install hexo-deployer-rsync --save

_config.yml中配置如下:

deploy:
  type: rsync
  host: <remote_host>
  user: <user>
  root: <網站根路徑>
  port: 22
  delete: [true|false] 刪除遠程主機上的舊文件
  verbose: [true|false] 顯示調試信息
  ignore_errors: [true|false] 忽略錯誤

使用下面命令部署到服務器

hexo deploy

主題更換

Next提供四種主題

創建菜單以及對應頁面

hexo new page tags
hexo new page categories

設置代碼高亮主題

NexT代碼高亮可選的值有 normalnightnight bluenight brightnight eighties

highlight_theme: normal

設置標籤雲

npm install hexo-tag-cloud --save
# hexo-tag-cloud 標籤雲 | see https://github.com/MikeCoder/hexo-tag-cloud
tag_cloud:
  textFont: Trebuchet MS, Helvetica # 字體
  textColor: '#555' # 字體顏色
  textHeight: 25 # 字體高度
  outlineColor: '#E2E1D1' # 字體背景色
  maxSpeed: 0.1 # 標籤雲最大移動速度
{% if site.tags.length > 1 %}
<script type="text/javascript" charset="utf-8" src="{{ url_for('/js/tagcloud.js') }}"></script>
<script type="text/javascript" charset="utf-8" src="{{ url_for('/js/tagcanvas.js') }}"></script>
<div class="widget-wrap">
    <div id="myCanvasContainer" class="widget tagcloud">
    <canvas width="220" height="250" id="resCanvas" style="width=100%">
        {{ list_tags() }}
    </canvas>
    </div>
</div>
{% endif %}

添加站內搜索

npm install hexo-generator-search  --save
npm install hexo-generator-searchdb --save

配置_config.yml

search:
  path: search.xml
  field: post
  format: html
  limit: 10000

修改next主題的配置文件_config.yml

local_search:
	enable: true

網頁底部訪問量顯示

在主題配置_config.yml文件中,修改如下

busuanzi_count:
  # count values only if the other configs are false
  enable: true
  # custom uv span for the whole site
  site_uv: true
  site_uv_header: <i class="fa fa-user"></i> 訪問人數
  site_uv_footer:
  # custom pv span for the whole site
  site_pv: true
  site_pv_header: <i class="fa fa-eye"></i> 總訪問量
  site_pv_footer:
  # custom pv span for one page only
  page_pv: true
  page_pv_header: <i class="fa fa-eye"></i> 閱讀次數
  page_pv_footer:

注意這裏需要將themes/next/layout/_third-party/analytics/busuanzi-counter.swig文件中<script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>替換成<script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>。不然會出現統計沒有效果!

閱讀全文按鈕

在需要的文章中添加

<!--more-->

頭像以及favicon.ico設置

打開主題配置文件_config.yml

avatar: /images/header.jpg

favicon:
	small: /images/favicon.ico
	medium: /images/favicon.ico

header.jpgfavicon.ico文件放在themes/next/source/images中即可

關於/%20/的問題

%20是空格的意思,把配置文件裏菜單的配置哪裏||之前的所有空格刪除掉即可解決問題!

設置炫酷動態背景

在主題配置_config.yml文件中

canvas_nest: true # 開啓即可

添加valine評論系統

參考官網

在主題配置文件中

valine:
   enable: true                                                                                                                                                                                                
   appid: <appid>
   appkey: <appkey>
   notify: false # mail notifier ,https://github.com/xCss/Valine/wiki
   verify: false # Verification code
   placeholder: 既然來了,就留下點什麼吧... # comment box placeholder
   avatar: mm # gravatar style
   guest_info: nick,mail,link # custom comment header
   pageSize: 10 # pagination size

更多參考:

Next官網

Hexo官網

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章