From fca44251220611d3e16dde28e983d1a5dee4626c Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Tue, 22 Nov 2022 22:38:25 +0800 Subject: [PATCH] [feat] override repo in front-matter --- layout/_partial/sidebar/widgets/ghissues.ejs | 7 +++---- layout/_partial/sidebar/widgets/ghrepo.ejs | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/layout/_partial/sidebar/widgets/ghissues.ejs b/layout/_partial/sidebar/widgets/ghissues.ejs index 0d73a38..e6aeabd 100644 --- a/layout/_partial/sidebar/widgets/ghissues.ejs +++ b/layout/_partial/sidebar/widgets/ghissues.ejs @@ -3,7 +3,9 @@ function layoutDiv() { var el = ''; var repo; var branch = 'main'; - if (page.layout === 'wiki' && page.wiki) { + if (page.repo) { + repo = page.repo + } else if (page.layout === 'wiki' && page.wiki) { let proj = theme.wiki.projects[page.wiki]; if (proj && proj.repo) { repo = proj.repo; @@ -11,9 +13,6 @@ function layoutDiv() { branch = proj.branch; } } - } else { - // 其它的如果有设置 repo 也可以 - repo = page.repo; } if (repo == undefined) { return el; diff --git a/layout/_partial/sidebar/widgets/ghrepo.ejs b/layout/_partial/sidebar/widgets/ghrepo.ejs index f302d28..dbfbbb0 100644 --- a/layout/_partial/sidebar/widgets/ghrepo.ejs +++ b/layout/_partial/sidebar/widgets/ghrepo.ejs @@ -3,7 +3,9 @@ function layoutDiv() { var el = ''; var repo; var branch = 'main'; - if (page.layout === 'wiki' && page.wiki) { + if (page.repo) { + repo = page.repo + } else if (page.layout === 'wiki' && page.wiki) { let proj = theme.wiki.projects[page.wiki]; if (proj && proj.repo) { repo = proj.repo; @@ -11,9 +13,6 @@ function layoutDiv() { branch = proj.branch; } } - } else { - // 其它的如果有设置 repo 也可以 - repo = page.repo; } if (repo == undefined) { return el;