From d2773b127eb36b1177fffe54d0fc14ea5f6a1077 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Wed, 6 Dec 2023 13:22:50 +0800 Subject: [PATCH] [feat] share & license in wiki --- .../_partial/main/article/article_footer.ejs | 139 +++++++++++------- 1 file changed, 86 insertions(+), 53 deletions(-) diff --git a/layout/_partial/main/article/article_footer.ejs b/layout/_partial/main/article/article_footer.ejs index 7d283c8..6006d1e 100644 --- a/layout/_partial/main/article/article_footer.ejs +++ b/layout/_partial/main/article/article_footer.ejs @@ -2,63 +2,82 @@ function layoutDiv() { var el = ''; var item = []; - if (page.references && page.references.length > 0) { + if (page.references?.length > 0) { item.push('references'); } - if (page.layout !== 'wiki') { - if (theme.article.license && theme.article.license.length > 0) { - item.push('license'); - } - if (theme.article.share && theme.article.share.length > 0) { - item.push('share'); - } + if (theme.article.license?.length > 0) { + item.push('license'); + } + if (theme.article.share?.length > 0) { + item.push('share'); } if (item.length === 0) { return el; } el += '
'; - if (page.references && page.references.length > 0) { - el += '
'; - el += '
'; - el += '' + __('meta.references') + ''; - el += '
'; - el += '
+ ` } + var license = '' if (page.layout == 'post') { - if (theme.article.license && page.license != false) { - el += '
'; - el += '
'; - el += '' + __('meta.license') + ''; - el += '
'; - el += '
'; - el += markdown(page.license || theme.article.license); - el += '
'; - el += '
'; + if (theme.article.license && (page.license != false)) { + license = markdown(page.license || theme.article.license) } + } else if (page.layout == 'wiki' && page.wiki) { + let proj = theme.wiki.tree[page.wiki] + if (page.license != null) { + license = markdown(page.license || theme.article.license) + } else if (proj?.license != null) { + license = markdown(proj.license || theme.article.license) + } + } + if (license.length > 0) { + el += ` +
+
${__('meta.license')}
+
${license}
+
+ ` + } - if (theme.article.share && page.share != false) { - el += '
'; - el += '
'; - el += '' + __('meta.share') + ''; - el += '
'; - el += '
';