From 426df4162390429ff346b6061b52446e447a7904 Mon Sep 17 00:00:00 2001 From: XPoet Date: Sun, 25 Sep 2022 13:36:55 +0800 Subject: [PATCH] feat(twikoo comment): custom seting twikoo version --- _config.yml | 3 ++- layout/_partial/comment/twikoo.ejs | 23 ++++++++++++++++------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/_config.yml b/_config.yml index 8cb2353..9cb8cda 100644 --- a/_config.yml +++ b/_config.yml @@ -203,7 +203,8 @@ comment: # See: https://github.com/imaegoo/twikoo twikoo: env_id: # Tencent Cloud environment id - region: # environment region. If select Guangzhou, fill in "ap-guangzhou". + region: # Environment region. If select Guangzhou, fill in "ap-guangzhou". + version: 1.6.7 # Twikoo version, default use v1.6.7, you can custom fill # --------------------------------------------------------------------------------------- # RSS diff --git a/layout/_partial/comment/twikoo.ejs b/layout/_partial/comment/twikoo.ejs index 957f6b8..072e549 100644 --- a/layout/_partial/comment/twikoo.ejs +++ b/layout/_partial/comment/twikoo.ejs @@ -1,19 +1,28 @@ -<% if(theme.comment.use === 'twikoo' && theme.comment.twikoo.env_id) { %> +<% +const { enable: pjax_enable } = theme.pjax +let { + env_id: tk_env_id, region: tk_region, version: tk_version +} = theme.comment.twikoo +if (!tk_version) { tk_version = '1.6.7' } +const twikoo_cdn_url = `//cdn.jsdelivr.net/npm/twikoo@${tk_version}/dist/twikoo.all.min.js` +%> +<% if(theme.comment.use === 'twikoo' && tk_env_id) { %>
-
-