mirror of
https://ghfast.top/https://github.com/zsjy/halo-theme-dream2.0-plus.git
synced 2025-03-15 16:39:40 +08:00
perf: 文章分享支持分享方式配置
This commit is contained in:
parent
33e0b50840
commit
f64a970354
@ -45,7 +45,7 @@ const channels = {
|
||||
}
|
||||
}
|
||||
|
||||
function defaultConfig() {
|
||||
function defaultConfig(sites) {
|
||||
return {
|
||||
url: location.href,
|
||||
origin: location.origin,
|
||||
@ -57,7 +57,7 @@ function defaultConfig() {
|
||||
// 图片或者图片所在的容器的选择器
|
||||
imageSelector: undefined,
|
||||
weiboKey: '',
|
||||
sites: ['qq', 'qzone', 'wechat', 'weibo', 'douban', 'linkedin', 'facebook', 'twitter', 'google', 'link', 'poster']
|
||||
sites: sites
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,7 +143,7 @@ function triggerPosterShare(config) {
|
||||
* @returns {*}
|
||||
*/
|
||||
function buildConfig(options) {
|
||||
const config = Object.assign(defaultConfig(), options)
|
||||
const config = Object.assign(defaultConfig(DreamConfig.post_share_sites), options)
|
||||
if (!config.summary) {
|
||||
config.summary = config.description
|
||||
}
|
||||
|
@ -70,6 +70,18 @@
|
||||
});'})]
|
||||
/** 主题配置 */
|
||||
const DreamConfig = {};
|
||||
/** 配置分享方式 */
|
||||
let post_share = []
|
||||
for (let share of [[${theme.config.post.custom_post_share}]]) {
|
||||
let type = share.realNode.type;
|
||||
if (post_share.indexOf(type) === -1) {
|
||||
post_share.push(type);
|
||||
}
|
||||
}
|
||||
if (post_share.length === 0) {
|
||||
post_share.push('link');
|
||||
}
|
||||
DreamConfig["post_share_sites"] = post_share;
|
||||
DreamConfig["theme_version"] = [[${theme.spec.version}]];
|
||||
DreamConfig["theme_base"] = "[(${#theme.assets('/')})]";
|
||||
[(${!#strings.isEmpty(theme.config.post.code_fold_line)?'DreamConfig["code_fold_line"] = "' + theme.config.post.code_fold_line + '";': ''})]
|
||||
|
Loading…
x
Reference in New Issue
Block a user