Skip to content

Commit

Permalink
Merge pull request #43 from jiewenhuang/dev
Browse files Browse the repository at this point in the history
Feat:新增文章评论区控制
  • Loading branch information
jiewenhuang authored Mar 13, 2024
2 parents 5a5779d + 2cc1ed9 commit d2c62ba
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 8 deletions.
43 changes: 42 additions & 1 deletion annotation-setting.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,48 @@
apiVersion: v1alpha1
kind: AnnotationSetting
metadata:
generateName: annotation-setting-
name: stack-annotation-post-setting
spec:
targetRef:
group: content.halo.run
kind: Post
formSchema:
- $formkit: "select"
name: "showComment"
label: "显示评论"
value: "true"
options:
- value: "true"
label: ""
- value: "false"
label: ""

---
apiVersion: v1alpha1
kind: AnnotationSetting
metadata:
name: stack-annotation-singlePage-setting
spec:
targetRef:
group: content.halo.run
kind: SinglePage
formSchema:
- $formkit: "select"
name: "showComment"
label: "显示评论"
value: "false"
options:
- value: "true"
label: ""
- value: "false"
label: ""

---

apiVersion: v1alpha1
kind: AnnotationSetting
metadata:
name: stack-annotation-menuItem-setting
spec:
targetRef:
group: ""
Expand Down
2 changes: 2 additions & 0 deletions templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,13 @@ <h3 class="article-subtitle" th:text="${singlePage.status.excerpt}">
</section>
</footer>
</article>
<th:block th:if="${#annotations.getOrDefault(singlePage, 'showComment', 'false') == 'true'}">
<!-- Comment-->
<th:block
th:replace="~{modules/common/comment :: ${theme.config.base.comment_system}(name=${singlePage.metadata.name}, kind='SinglePage')}">

</th:block>
</th:block>


<!--Footer-->
Expand Down
13 changes: 7 additions & 6 deletions templates/page_links.html
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,16 @@ <h2 class="article-title">
</footer>
</article>
</th:block>
<!-- Comment-->
<th:block th:if="${theme.config.links.enable_comment}">
<th:block
th:replace="~{modules/common/comment :: ${theme.config.base.comment_system}(name=${singlePage.metadata.name}, kind='SinglePage')}">

</th:block>
</th:block>

<!--Footer-->
<th:block th:replace="~{modules/common/footer :: footer}"></th:block>
<th:block th:replace="~{modules/pswp :: pswp}"></th:block>
<script th:src="@{/assets/lib/photoswipe/js/photoswipe.min.js}" integrity="sha256-ePwmChbbvXbsO02lbM3HoHbSHTHFAeChekF1xKJdleo=" crossorigin="anonymous" defer=""></script>
<script th:src="@{/assets/lib/photoswipe/js/photoswipe-ui-default.min.js}" integrity="sha256-UKkzOn/w1mBxRmLLGrSeyB4e1xbrp4xylgAWb3M42pU=" crossorigin="anonymous" defer="">
</script>
<link rel="stylesheet" th:href="@{/assets/lib/photoswipe/css/default-skin.min.css}" crossorigin="anonymous">
<link rel="stylesheet" th:href="@{/assets/lib/photoswipe/css/photoswipe.min.css}" crossorigin="anonymous">

</main>
</div>
Expand Down
2 changes: 2 additions & 0 deletions templates/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,13 @@ <h3 class="article-subtitle" th:text="${post.status.excerpt}">
<!-- Related Article-->
<th:block th:replace="~{modules/related-article :: related}"></th:block>
</th:block>
<th:block th:if="${#annotations.getOrDefault(post, 'showComment', 'true') == 'true'}">
<!-- Comment-->
<th:block
th:replace="~{modules/common/comment :: ${theme.config.base.comment_system}(name=${post.metadata.name}, kind='Post')}">

</th:block>
</th:block>


<!--Footer-->
Expand Down
2 changes: 1 addition & 1 deletion theme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ spec:
repo: "https://github.com/jiewenhuang/halo-theme-stack"
settingName: "theme-Stack2-setting"
configMapName: "theme-Stack2-configMap"
version: "2.1.1"
version: "2.1.2"
requires: ">=2.11.0"

0 comments on commit d2c62ba

Please sign in to comment.