[Hexo架站懶人包] - 安裝Like Coin 讚賞鍵

hexo_github

Like Coin官網教學的內容引用自只是個打字的 的教學文章,講解的已經滿清楚

But!
之前在許多文章都提過,HEXO NEXT 版本6 → 8之後就有了滿大的改動,許多常用的套件設定都已經整合進config中
因此很多網路上看到的教學文章採用的設定方法已經不太適用

安裝教學(old)

安裝教學(new)

But!
新版教學文章雖然標題有寫到Like Coin如何引入,但內文可以說幾乎一行都沒提到XD
但他有提到了一個新的重點就是,新版NEXT主題提供了custom files的寫法,讓你可以把以前很多侵入式的script寫法拉出來管理

詳細設定可以在_config.next.yml中找到,照著comment新增對應的資料夾和檔案即可
一般看到的Like Coin大多都放在文章結尾的下方,因此footer或postBodyEnd都可以使用看看

1
2
3
4
5
6
7
8
9
10
11
12
13
# Define custom file paths.
# Create your custom files in site directory `source/_data` and uncomment needed files below.
custom_file_path:
#head: source/_data/head.njk
#header: source/_data/header.njk
#sidebar: source/_data/sidebar.njk
#postMeta: source/_data/post-meta.njk
# postBodyEnd: source/_data/post-body-end.njk
footer: source/_data/footer.njk
#bodyEnd: source/_data/body-end.njk
#variable: source/_data/variables.styl
#mixin: source/_data/mixins.styl
#style: source/_data/styles.styl

footer : 會放在外面
image_footer

postBodyEnd : 跟文章的背景一樣是灰色的
image_post