Skip to content

Commit

Permalink
add comment function
Browse files Browse the repository at this point in the history
  • Loading branch information
kmbravo committed Oct 14, 2024
1 parent 0d7f4bc commit 5566b60
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
26 changes: 18 additions & 8 deletions _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,25 @@ <h1>{{ page.title }}</h1>
{{ content }}
</div>
<div class="date">
Written on {{ page.date | date: "%B %e, %Y" }}
发表于 {{ page.date | date: "%Y年%m月%d日" }}
</div>

<!-- 添加评论系统 -->
<script src="https://utteranc.es/client.js"
repo="[kmbravo]/[kmbravo.github.io]"
issue-term="pathname"
theme="github-light"
crossorigin="anonymous"
async>
<!-- 添加 Utterances 评论系统 -->
<script>
let theme = 'github-light'; // 默认主题
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
theme = 'github-dark';
}

let script = document.createElement('script');
script.src = 'https://utteranc.es/client.js';
script.setAttribute('repo', 'kmbravo/kmbravo.github.io');
script.setAttribute('issue-term', 'pathname');
script.setAttribute('label', 'cmt');
script.setAttribute('theme', theme);
script.setAttribute('crossorigin', 'anonymous');
script.setAttribute('async', '');

document.querySelector('.post').appendChild(script);
</script>
</article>
1 change: 1 addition & 0 deletions _posts/2023-04-15-my-first-post.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
layout: post
title: "我的第一篇博客文章"
date: 2023-04-15
comments: true
---

这里是您的博客文章内容。

0 comments on commit 5566b60

Please sign in to comment.