From f3f68db3d83d3d026d746beb0f7ef359f7600714 Mon Sep 17 00:00:00 2001 From: fechin Date: Thu, 22 Dec 2022 15:26:00 +0800 Subject: [PATCH] Edit page button --- themes/coo/layout/_partial/header.ejs | 20 ++++++++------------ themes/coo/scripts/github.js | 7 ++++++- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/themes/coo/layout/_partial/header.ejs b/themes/coo/layout/_partial/header.ejs index 1ef62a8..338b680 100644 --- a/themes/coo/layout/_partial/header.ejs +++ b/themes/coo/layout/_partial/header.ejs @@ -13,22 +13,18 @@ K - + + + + + + - <% if (postPage) { %> - - - - <% } %> diff --git a/themes/coo/scripts/github.js b/themes/coo/scripts/github.js index 8293128..1c1c7fa 100644 --- a/themes/coo/scripts/github.js +++ b/themes/coo/scripts/github.js @@ -8,5 +8,10 @@ hexo.extend.helper.register("contributing", function () { hexo.extend.helper.register("edit_page", function () { - return `https://github.com/Fechin/reference/blob/main/source/_posts/${this.page.slug}.md` + let postPage = this.page['layout'] === 'post'; + let url = "https://github.com/Fechin/reference"; + if (postPage) { + url += `/blob/main/source/_posts/${this.page.slug}.md`; + } + return url; }); \ No newline at end of file