diff --git a/_config.yml b/_config.yml index 3f92437..5cd10a1 100644 --- a/_config.yml +++ b/_config.yml @@ -317,6 +317,7 @@ valine: emojiCDN: # emoji CDN enableQQ: false # enable the Nickname box to automatically get QQ Nickname and QQ Avatar requiredFields: nick,mail # required fields (nick/mail) + option: # utterances # https://utteranc.es/ diff --git a/layout/includes/third-party/comments/valine.pug b/layout/includes/third-party/comments/valine.pug index ac7e3d1..6e09a81 100644 --- a/layout/includes/third-party/comments/valine.pug +++ b/layout/includes/third-party/comments/valine.pug @@ -1,3 +1,4 @@ +- let option = theme.valine.option ? JSON.stringify(theme.valine.option) : false - let emojiMaps = '""' if site.data.valine - emojiMaps = JSON.stringify(site.data.valine) @@ -5,7 +6,7 @@ if site.data.valine script. function loadValine () { function initValine () { - const initData = { + let initData = { el: '#vcomment', appId: '#{theme.valine.appId}', appKey: '#{theme.valine.appKey}', @@ -25,7 +26,12 @@ script. if (!{Boolean(theme.valine.requiredFields)}) { initData.requiredFields= ('!{theme.valine.requiredFields}'.split(',')) } - + + if (!{Boolean(option)}) { + const otherData = !{option} + initData = Object.assign({}, initData, otherData) + } + const valine = new Valine(initData) } diff --git a/layout/includes/third-party/math/mathjax.pug b/layout/includes/third-party/math/mathjax.pug index d28b3b8..c87965f 100644 --- a/layout/includes/third-party/math/mathjax.pug +++ b/layout/includes/third-party/math/mathjax.pug @@ -41,7 +41,7 @@ script. } } - var script = document.createElement('script') + const script = document.createElement('script') script.src = '!{theme.CDN.mathjax}' script.id = 'MathJax-script' script.async = true diff --git a/package.json b/package.json index ad087f2..2dfee5e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-butterfly", - "version": "3.2.0", + "version": "3.3.0-b1", "description": "A Simple and Card UI Design theme for Hexo", "main": "package.json", "scripts": { diff --git a/scripts/helpers/related_post.js b/scripts/helpers/related_post.js index 5691e79..ee06e06 100644 --- a/scripts/helpers/related_post.js +++ b/scripts/helpers/related_post.js @@ -71,7 +71,7 @@ hexo.extend.helper.register('related_posts', function (currentPost, allPosts) { lazySrc + '="' + this.url_for(cover) + - '">' + '" alt="cover">' if (dateType === 'created') { result += '