Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

Commit

Permalink
add-feature-comments 添加评论功能
Browse files Browse the repository at this point in the history
  • Loading branch information
JackyLee3362 committed Apr 3, 2024
1 parent 746cd76 commit 2141470
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 5 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ JackyLee 的博客

<https://jackylee3362.github.io/>

## 讨论功能

使用 Github 的 Discussions 进行评论区的模拟

## 主题

[adityatelange/hugo-PaperMod: A fast, clean, responsive Hugo theme.](https://github.com/adityatelange/hugo-PaperMod)
1 change: 1 addition & 0 deletions archetypes/post.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ draft: true
author: JackyLee
tags: ["未分类"]
categories: ["未分类"]
comments: true
---
1 change: 1 addition & 0 deletions content/posts/git-scenario/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ draft: false
author: JackyLee
tags: ["git"]
categories: ["场景"]
comments: true
---

在使用 Github 的时候,由于对远程分支和本地分支理解不够深刻,难免会出现各种问题
Expand Down
22 changes: 22 additions & 0 deletions content/posts/hugo-tutorial/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ draft: false
author: JackyLee
tags: ["go"]
categories: ["教程"]
comments: true
---

## 配置文件
Expand Down Expand Up @@ -33,10 +34,31 @@ taxonomies:
## 添加评论功能
### 方法一:原始的标签
最简单的是在 Giscus 配置好以后,获得 `<script>...</script>` 标签的内容,在 `themes/<theme_name>/layouts/partials/templates/comments.html` 里复制上

然后在 `footer.html` 的末尾添加如下代码

```html
{{- partial "comments.html" . -}}
```

该方法的问题

1. 在任何页面都会产生评论功能,比如主页,就不是很好看
2. 只能对特定主题生效,切换主题仍然需要重新配置

### 方法二:配置文件

todo

[Hugo 博客添加 Giscus 评论功能 | 云吱的小站](https://haoyep.com/posts/hugo-add-component/)

[giscus](https://giscus.app/zh-CN)

[Adding comments system to a Hugo site using Giscus](https://www.justinjbird.me/blog/2023/adding-comments-to-a-hugo-site-using-giscus/)

## 参考

[LoveIt](https://hugoloveit.com/zh-cn/)
Expand Down
1 change: 1 addition & 0 deletions content/posts/my-first-post.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title: "我的第一篇博客"
date: 2024-04-03T10:54:36+08:00
draft: false
author: JackyLee
comments: true
---

非常欢迎来到我的博客
9 changes: 5 additions & 4 deletions hugo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,20 @@ params:
# limit: 10 # refer: https://www.fusejs.io/api/methods.html#search
# keys: ["title", "permalink", "summary", "content"]

# 评论功能
# 评论功能 好像没啥用
page:
comment:
enable: true
giscus:
enable: true
repo: JackyLee3362/Jackylee3362.github.io
repoId: R_kgDOLpCD4w
category: Announcements
categoryId: DIC_kwDOLpCD484Ceavz
lang:
lang: ""
mapping: pathname
reactionsEnabled: 1
emitMetadata: 0
reactionsEnabled: "1"
emitMetadata: "0"
inputPosition: bottom
lazyLoading: false
lightTheme: light
Expand Down
2 changes: 1 addition & 1 deletion themes/PaperMod

0 comments on commit 2141470

Please sign in to comment.