From 503b2fd16ca51a29dc44b791a568f706acc5bbb6 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Mon, 8 Jan 2024 12:38:50 +0800 Subject: [PATCH] [opt] license author info --- .../_partial/main/article/article_footer.ejs | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/layout/_partial/main/article/article_footer.ejs b/layout/_partial/main/article/article_footer.ejs index e7f998e..0524213 100644 --- a/layout/_partial/main/article/article_footer.ejs +++ b/layout/_partial/main/article/article_footer.ejs @@ -40,25 +40,36 @@ function layoutDiv() { var license = '' if (page.layout == 'post') { if (theme.article.license && (page.license != false)) { - license = markdown(page.license || theme.article.license) + license = 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) + license = page.license || theme.article.license } else if (proj?.license != null) { if (proj.license == true) { - license = markdown(theme.article.license) + license = theme.article.license } else { - license = markdown(proj.license) + license = proj.license } } } if (license.length > 0) { + var author = null + if (theme.authors) { + if (page.author?.length > 0 && theme.authors[page.author] != null) { + author = theme.authors[page.author] + } else { + author = theme.default_author + } + } + if (author) { + license = license.replace('${author.name}', author.name).replace('${author.url}', author.url) + } el += `
${__('meta.license')}
-
${license}
+
${markdown(license)}
` }