Skip to content

Commit

Permalink
feat: add support for hiding upvote and share buttons on posts (#165)
Browse files Browse the repository at this point in the history
支持隐藏文章的点赞和分享按钮。

/kind feature

Fixes #158

```release-note
支持隐藏文章的点赞和分享按钮。
```
  • Loading branch information
ruibaby authored Aug 26, 2024
1 parent f43a011 commit 0cf51c3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
12 changes: 12 additions & 0 deletions settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,20 @@ spec:
value: github
- label: Tailwind CSS Typography
value: tailwind
- $formkit: checkbox
name: show_upvote_button
label: 显示点赞按钮
value: true
- $formkit: checkbox
name: show_share_button
id: show_share_button
label: 显示分享按钮
value: true
- $formkit: repeater
if: $get(show_share_button).value
name: share_items
key: share_items
id: share_items
label: 分享按钮
value:
- id: wechat
Expand Down
7 changes: 6 additions & 1 deletion templates/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ <h2 class="inline-flex items-center gap-2 text-base dark:text-slate-50">
</div>
</div>
<div class="flex flex-row items-center gap-1.5 self-end">
<div @click="handleUpvote(name)" class="group inline-flex cursor-pointer items-center rounded-lg">
<div
th:if="${theme.config.post.show_upvote_button}"
@click="handleUpvote(name)"
class="group inline-flex cursor-pointer items-center rounded-lg"
>
<div
class="inline-flex items-center justify-center rounded-full p-2 transition-all group-hover:bg-gray-100 dark:group-hover:bg-slate-700"
>
Expand Down Expand Up @@ -94,6 +98,7 @@ <h2 class="inline-flex items-center gap-2 text-base dark:text-slate-50">
</a>

<div
th:if="${theme.config.post.show_share_button}"
th:attr="x-data=|share(${theme.config.post.share_items})|"
class="group inline-flex cursor-pointer items-center gap-0.5 rounded-lg"
@click="shareModal = true"
Expand Down

0 comments on commit 0cf51c3

Please sign in to comment.