mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-12 22:17:06 +08:00
Merge branch 'dev' of https://github.com/jerryc127/hexo-theme-butterfly into dev
This commit is contained in:
11
_config.yml
11
_config.yml
@@ -795,6 +795,15 @@ artitalk:
|
||||
appKey:
|
||||
option:
|
||||
|
||||
# HexoPlusPlus Talk
|
||||
# see https://hexoplusplus.js.org
|
||||
hexoplusplus:
|
||||
domain:
|
||||
talk:
|
||||
limit: 10
|
||||
start: 0
|
||||
option:
|
||||
|
||||
# Pjax [Beta]
|
||||
# It may contain bugs and unstable, give feedback when you find the bugs.
|
||||
# https://github.com/MoOx/pjax
|
||||
@@ -952,3 +961,5 @@ CDN:
|
||||
prismjs_autoloader: https://cdn.jsdelivr.net/npm/prismjs/plugins/autoloader/prism-autoloader.min.js
|
||||
|
||||
artitalk: https://cdn.jsdelivr.net/npm/artitalk
|
||||
hpptalk: https://cdn.jsdelivr.net/gh/HexoPlusPlus/HexoPlusPlus/talk_user.js
|
||||
hpptalk_css: https://cdn.jsdelivr.net/gh/HexoPlusPlus/HexoPlusPlus/talk.css
|
||||
|
||||
38
layout/includes/page/hpptalk.pug
Normal file
38
layout/includes/page/hpptalk.pug
Normal file
@@ -0,0 +1,38 @@
|
||||
- let hpptalkOption = theme.hexoplusplus.talk.option ? JSON.stringify(theme.hexoplusplus.talk.option) : false
|
||||
|
||||
if top_img === false
|
||||
h1.page-title= page.title
|
||||
|
||||
#hpp_talk
|
||||
script.
|
||||
(()=>{
|
||||
let setting = {
|
||||
id: "hpp_talk",
|
||||
domain: '!{theme.hexoplusplus.domain}',
|
||||
limit: !{theme.hexoplusplus.talk.limit},
|
||||
start: !{theme.hexoplusplus.talk.start},
|
||||
}
|
||||
|
||||
if (!{Boolean(hpptalkOption)}) {
|
||||
const otherSetting = !{hpptalkOption}
|
||||
setting = Object.assign(setting, otherSetting)
|
||||
}
|
||||
|
||||
const init = () => {
|
||||
new hpp_talk(setting)
|
||||
}
|
||||
|
||||
const addCss = () => {
|
||||
const link = document.createElement('link')
|
||||
link.rel = 'stylesheet'
|
||||
link.href = '!{url_for(theme.CDN.hpptalk_css)}'
|
||||
document.head.appendChild(link)
|
||||
}
|
||||
|
||||
if (typeof hpp_talk === 'function') {
|
||||
init()
|
||||
} else {
|
||||
addCss()
|
||||
getScript('!{url_for(theme.CDN.hpptalk)}').then(init)
|
||||
}
|
||||
})()
|
||||
@@ -11,6 +11,8 @@ block content
|
||||
include includes/page/categories.pug
|
||||
when 'artitalk'
|
||||
include includes/page/artitalk.pug
|
||||
when 'hpptalk'
|
||||
include includes/page/hpptalk.pug
|
||||
default
|
||||
include includes/page/default-page.pug
|
||||
|
||||
|
||||
Reference in New Issue
Block a user