hexo icarus 主題安裝使用中遇到的問題以及解決方案

首次使用主題報錯

我在按照 icarus 指南安裝啓用後預覽就發現整個首頁報錯,如下圖所示:

const { Component } = require('inferno'); const classname = require('hexo-component-inferno/lib/util/classname'); const Head = require('./common/head'); const Navbar = require('./common/navbar'); const Widgets = require('./common/widgets'); const Footer = require('./common/footer'); const Scripts = require('./common/scripts'); const Search = require('./common/search'); module.exports = class extends Component { render() { const { site, config, page, helper, body } = this.props; const language = page.lang || page.language || config.language; const columnCount = Widgets.getColumnCount(config.widgets); return ; } };

於是搜索到了鏈接(https://githubmemory.com/repo/ppoffice/hexo-theme-icarus/issues/855)找到了作者提供的解決方案,可能是之前使用其他插件導致了衝突,建議我們重新在新的 hexo 啓用 icaurs。

hexo init NewBlog
cd NewBlog
npm install hexo-theme-icarus
hexo config theme icarus
hexo clean
// 之後按照提示安裝Icarus的其他依賴
// 最後運行
hexo serve

但是我按照作者教程操作後依然報錯。

npm install hexo-theme-icarus

這時候看本地的 theme 目錄,發現 icarus 下根本就是空白的!這句 npm 代碼根本不會在本地生成 icarus 主題文件,主題並沒有下載下來,懷疑和網絡防火牆有關。於是我用 git 才把主題文件下載下來。

啓用主題後首次生成插件報錯

INFO  === Checking package dependencies ===
ERROR Package bulma-stylus is not installed.
ERROR Package hexo-renderer-inferno is not installed.
ERROR Package hexo-component-inferno is not installed.
ERROR Package inferno is not installed.
ERROR Package inferno-create-element is not installed.
ERROR Please install the missing dependencies your Hexo site root directory:
ERROR npm install --save [email protected] hexo-renderer-inferno@^0.1.3 hexo-component-inferno@^0.11.0 inferno@^7.3.3 inferno-create-element@^7.3.3
ERROR or:
ERROR yarn add [email protected] hexo-renderer-inferno@^0.1.3 hexo-component-inferno@^0.11.0 inferno@^7.3.3 inferno-create-element@^7.3.3

這個提示簡單,按照要求 npm 缺少的指定的插件就可以了。

bulma-stylus‘s 版本過高

插件安裝完又提示 bulma-stylus‘s 版本過高,這個也簡單,按照提示安裝 0.8.0 版本的插件就可以了。

INFO  === Checking package dependencies ===
ERROR Package bulma-stylus's version (0.9.1) does not satisfy the required version (0.8.0).
ERROR Please install the missing dependencies your Hexo site root directory:
ERROR npm install --save [email protected]
ERROR or:
ERROR yarn add [email protected]

經過一系列操作終於是成功啓動 hexo 預覽和生成了不過還是又一些警告,似乎對博客沒啥影響,我就沒去管了。

INFO  === Checking package dependencies ===
INFO  === Checking theme configurations ===
WARN  None of the following configuration files is found:
WARN  - /Users/dengjiangling/Documents/HexoBlog/_config.icarus.yml
WARN  - /Users/dengjiangling/Documents/HexoBlog/themes/icarus/_config.yml
INFO  Generating theme configuration file...
INFO  /Users/dengjiangling/Documents/HexoBlog/_config.icarus.yml created successfully.
INFO  To skip configuration generation, use "--icarus-dont-generate-config".
INFO  === Registering Hexo extensions ===
INFO  Start processing
INFO  Hexo is running at <http://localhost:4000> . Press Ctrl+C to stop.
(node:49753) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:49753) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:49753) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
(node:49753) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(node:49753) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:49753) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency

在 iicarus 主題中集成 twikoo 評論系統失敗了

我按照 twikoo 官方教程來到(https://www.anzifan.com/post/icarus_to_candy_2/)按照步驟操作,結果報錯

FATAL YAMLException: bad indentation of a mapping entry (167:3)

164 | # Disqus shortname
165 | #shortname: ‘’
166 | type: twikoo

目前沒找到解決方案。

讓目錄懸停

作者說通過 sticky: true 懸停,但是這樣只能讓整個側邊欄懸停,由於默認 Profile widget 在前,如果整個懸停,大概率只能看到 Profile。

我想到了一個辦法,我把 Profile widget 和目錄 widget 調換位置,讓目錄在前,然後設置整個左側邊欄 sticky: true。因爲首頁沒有目錄,所以 Profile widget 還是第一,而文章頁有目錄,目錄 widget 則在前。

如果要更完美一直讓目錄懸停,可以參考:https://github.com/ppoffice/hexo-theme-icarus/issues/673#issuecomment-612656959 。這個辦法我沒事,應該要魔改代碼,怕以後導致升級出問題,不亂改了。

在 footer 顯示備案號

如下,links 除了支持 icon 鏈接,也可以用 <文字>:<鏈接> 的方式直接放文字鏈接。

footer:
    # Links to be shown on the right of the footer section
    links:
        備案號:湘ICP備15019925號-1: '<http://beian.miit.gov.cn/>'

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