diff --git a/_config.yml b/_config.yml index 75bc97d..e8fbb3a 100644 --- a/_config.yml +++ b/_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 diff --git a/layout/includes/page/hpptalk.pug b/layout/includes/page/hpptalk.pug new file mode 100644 index 0000000..5969f73 --- /dev/null +++ b/layout/includes/page/hpptalk.pug @@ -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) + } + })() \ No newline at end of file diff --git a/layout/page.pug b/layout/page.pug index 7287546..0f2733c 100644 --- a/layout/page.pug +++ b/layout/page.pug @@ -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