0%

[筆記] Hexo - nexT 基礎配置 (二)

自己在建置的時候查了很多資料,整理完希望幫助到有需要的人
此篇文章需要下載一些而外的套件

pjax 安裝 (還不知道要做啥)

pjax 實現了 URL 改變但不重新整理整個頁面,也就是只有局部的頁面會更新,不會讓整個頁面重新閃動(重新整理)。那這個功能有什麼特色呢?最重要的就是原本左下角的音樂播放器遇到切換頁面,就會停掉然後重新載入;但使用 pjax 後就能解決這個問題。

/themes/next/_config.yml,修改 pjax: true:

1
2
3
# Easily enable fast Ajax navigation on your website.
# Dependencies: https://github.com/theme-next/theme-next-pjax
pjax: true (default null)
1
git clone https://github.com/theme-next/theme-next-pjax themes/next/source/lib/pjax

文章字數統計/閱讀時間安裝

/themes/next/_config.yml

1
2
3
4
5
6
# Post wordcount display settings
# Dependencies: https://github.com/theme-next/hexo-symbols-count-time
symbols_count_time:
separated_meta: true # 是否"換行顯示"字數統計及閱讀時長
item_text_post: false # 字數統計和閱讀時長是要使用小圖示(true)還是文字表示(false)
item_text_total: false # 文章底部的字數統計和閱讀時長是要使用小圖示(true)還是文字表示(false)

讓google可以搜尋到你的網站

1
npm i hexo-generator-sitemap --save

Hexo 資料夾根目錄 /_config.yml

1
2
sitemap:
path: sitemap.xml

但事情沒這麼單純,之後有空再寫

文章搜尋功能安裝

/themes/next/_config.yml

1
2
local_search:
enable: true (default false)
1
npm install hexo-generator-searchdb --save

Hexo 資料夾根目錄 /_config.yml
自己加上,加入最末端即可

1
2
3
4
5
6
# 文章搜尋功能
search:
path: search.xml
field: post
content: true
format: html

頁面滾動進度條

1
2
reading_progress:
enable: true (default false)

(好像要下載這個,但我好像沒有)

1
git clone https://github.com/theme-next/theme-next-reading-progress source/lib/reading_progress

頁面載入進度條

我的沒反應QQQQQ

1
git clone https://github.com/theme-next/theme-next-pace source/lib/pace
1
2
3
4
5
6
pace:
enable: true
# Themes list:
# big-counter | bounce | barber-shop | center-atom | center-circle | center-radar | center-simple
# corner-indicator | fill-left | flat-top | flash | loading-bar | mac-osx | material | minimal
theme: minimal

閱讀統計

1
2
busuanzi_count:
enable: true

圖片

文章中程式碼設置

  • 區塊樣式
    可至 themes 挑選

    1
    2
    3
    4
    5
    6
    theme:
    light: atom-one-dark-reasonable
    dark: tomorrow-night
    prism:
    light: prism
    dark: prism-dark
  • copy button

    1
    2
    3
    4
    5
    border_radius:
    copy_button:
    enable: true
    # Available values: default | flat | mac
    style: flat