Edit page button

This commit is contained in:
fechin committed 2022-12-22 15:26:00 +08:00
1 parent ab2750c248
commit f3f68db3d8
2 files changed
+14 -13

No files matched your search

+8 -12
View File
@@ -13,22 +13,18 @@
<span class="font-sans">K</span>
</span>
</button>
<a href="/sponsor/">
<a href="<%- edit_page() %>" target="_blank">
<button type="button"
class="fadeIn inline-flex h-8 items-center rounded-full bg-slate-200 dark:bg-gray-900 text-slate-700 dark:text-gray-300 ml-1 lg:ml-4 px-2 md:px-3 py-2 md:hover:bg-slate-300 md:dark:hover:bg-slate-800">
<i class="icon icon-heart text-red-600 animate-pulse md:mr-2"></i>
<span class="hidden md:inline text-sm">Sponsor</span>
<i class="icon icon-github md:mr-2"></i>
<span class="hidden md:inline text-sm">Github</span>
</button>
<!-- <button type="button"-->
<!-- class="fadeIn inline-flex h-8 items-center rounded-full bg-slate-200 dark:bg-gray-900 text-slate-700 dark:text-gray-300 ml-1 lg:ml-4 px-2 md:px-3 py-2 md:hover:bg-slate-300 md:dark:hover:bg-slate-800">-->
<!-- <i class="icon icon-github md:mr-2"></i>-->
<!-- <span class="hidden md:inline text-sm">Edit</span>-->
<!-- </button>-->
</a>
<% if (postPage) { %>
<a href="<%- edit_page() %>" target="_blank">
<button type="button"
class="fadeIn inline-flex h-8 items-center rounded-full bg-slate-200 dark:bg-gray-900 text-slate-700 dark:text-gray-300 ml-1 lg:ml-4 px-2 md:px-3 py-2 md:hover:bg-slate-300 md:dark:hover:bg-slate-800">
<i class="icon icon-github md:mr-2"></i>
<span class="hidden md:inline text-sm">Edit</span>
</button>
</a>
<% } %>
<button id="darkMode" class="fadeIn inline-flex items-center justify-center flex-shrink-0 h-8 w-8 rounded-full text-gray-900 ml-1 lg:ml-4 dark:text-gray-300 bg-gray-200 dark:bg-gray-900">
<i class="icon icon-light text-gray-600 dark:text-gray-300 dark:hover:text-white"></i>
</button>
+6 -1
View File
@@ -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;
});