文章元数据添加版权声明控制
This commit is contained in:
parent
41ad56ba2b
commit
8d3a165be7
|
@ -1,3 +1,42 @@
|
|||
apiVersion: v1alpha1
|
||||
kind: AnnotationSetting
|
||||
metadata:
|
||||
generateName: annotation-setting-
|
||||
spec:
|
||||
targetRef:
|
||||
group: content.halo.run
|
||||
kind: Post
|
||||
formSchema:
|
||||
- $formkit: "radio"
|
||||
name: "copyrightEnable"
|
||||
id: "copyrightEnable"
|
||||
key: "copyrightEnable"
|
||||
label: "显示版权声明"
|
||||
value: "true"
|
||||
options:
|
||||
- label: "显示"
|
||||
value: "true"
|
||||
- label: "隐藏"
|
||||
value: "false"
|
||||
- $formkit: "radio"
|
||||
name: "copyrightType"
|
||||
if: "$get(copyrightEnable).value == 'true'"
|
||||
label: "版权声明类型"
|
||||
value: "original"
|
||||
options:
|
||||
- label: "原创"
|
||||
value: "original"
|
||||
- label: "转载"
|
||||
value: "reprint"
|
||||
- $formkit: "text"
|
||||
name: "copyrightUrl"
|
||||
if: "$get(copyrightEnable).value == 'true'"
|
||||
label: "版权声明链接"
|
||||
help: "默认后台设置链接"
|
||||
placeholder: "请输入链接"
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1alpha1
|
||||
kind: AnnotationSetting
|
||||
metadata:
|
||||
|
@ -15,9 +54,9 @@ spec:
|
|||
value: "0"
|
||||
label: "该菜单的子菜单是否为垂直菜单"
|
||||
options:
|
||||
- label: 是
|
||||
- label: "是"
|
||||
value: "1"
|
||||
- label: 否
|
||||
- label: "否"
|
||||
value: "0"
|
||||
---
|
||||
|
||||
|
@ -27,20 +66,20 @@ metadata:
|
|||
generateName: annotation-setting-
|
||||
spec:
|
||||
targetRef:
|
||||
group: "core.halo.run"
|
||||
group: core.halo.run
|
||||
kind: LinkGroup
|
||||
formSchema:
|
||||
- $formkit: "radio"
|
||||
name: "displayStyle"
|
||||
label: "分组方式"
|
||||
value: default
|
||||
value: "default"
|
||||
options:
|
||||
- label: 默认
|
||||
value: default
|
||||
- label: 美化
|
||||
value: beautify
|
||||
- label: 失联
|
||||
value: deprecated
|
||||
- label: "默认"
|
||||
value: "default"
|
||||
- label: "美化"
|
||||
value: "beautify"
|
||||
- label: "失联"
|
||||
value: "deprecated"
|
||||
- $formkit: "textarea"
|
||||
name: "description"
|
||||
label: "描述"
|
||||
|
@ -53,7 +92,7 @@ metadata:
|
|||
generateName: annotation-setting-
|
||||
spec:
|
||||
targetRef:
|
||||
group: "core.halo.run"
|
||||
group: core.halo.run
|
||||
kind: Link
|
||||
formSchema:
|
||||
- $formkit: "attachment"
|
||||
|
@ -75,7 +114,7 @@ metadata:
|
|||
generateName: annotation-setting-
|
||||
spec:
|
||||
targetRef:
|
||||
group: "core.halo.run"
|
||||
group: core.halo.run
|
||||
kind: PhotoGroup
|
||||
formSchema:
|
||||
- $formkit: "attachment"
|
||||
|
|
|
@ -1421,27 +1421,29 @@ spec:
|
|||
- $formkit: group
|
||||
name: copyrights
|
||||
label: 版权声明
|
||||
help: 需要在发布文章时的元数据上选显示版权声明才可以生效
|
||||
value:
|
||||
enable: false
|
||||
content:
|
||||
content: '本文是原创文章,采用 <a target="_blank" href="/cc">CC BY-NC-ND 4.0</a> 协议,完整转载请注明来自 <a href="/" target="_blank" >程序员小航</a>'
|
||||
reprintContent: '本文是转载文章,版权归原作者所有。建议访问原文,转载本文请联系原作者。'
|
||||
children:
|
||||
- $formkit: radio
|
||||
name: enable
|
||||
id: enable
|
||||
key: enable
|
||||
value: false
|
||||
options:
|
||||
- label: 打开
|
||||
value: true
|
||||
- label: 关闭
|
||||
value: false
|
||||
help: 文章底部显示版权声明模块
|
||||
- $formkit: "text"
|
||||
name: "originalUrl"
|
||||
label: "原创链接"
|
||||
placeholder: "请输入链接"
|
||||
- $formkit: "text"
|
||||
name: "reprintUrl"
|
||||
label: "转载链接"
|
||||
placeholder: "请输入链接"
|
||||
- $formkit: textarea
|
||||
if: $get(enable).value
|
||||
name: content
|
||||
label: 声明内容
|
||||
label: 原创声明内容
|
||||
placeholder: '本文是原创文章,采用 <a target="_blank" href="/cc">CC BY-NC-ND 4.0</a> 协议,完整转载请注明来自 <a href="/" target="_blank" >程序员小航</a>'
|
||||
help: 支持 HTML 语法
|
||||
- $formkit: textarea
|
||||
name: reprintContent
|
||||
label: 转载声明内容
|
||||
placeholder: '本文是转载文章,版权归原作者所有。建议访问原文,转载本文请联系原作者。'
|
||||
help: 支持 HTML 语法
|
||||
- $formkit: select
|
||||
name: recommendQuantity
|
||||
label: 阅读建议
|
||||
|
|
|
@ -78,11 +78,18 @@
|
|||
</div>
|
||||
|
||||
<!-- 版权声明 -->
|
||||
<div class="post-copyright" th:if="${theme.config.post.copyrights.enable}">
|
||||
<div class="post-copyright__author">
|
||||
<div class="post-copyright" th:with="copyrightUrl =${#annotations.get(post, 'copyrightUrl')},
|
||||
copyrightEnable = ${#strings.equals(#annotations.getOrDefault(post, 'copyrightEnable','true'),'true')}">
|
||||
<div class="post-copyright__author" >
|
||||
<!-- 版权页 以及版权描述文字 -->
|
||||
<a class="post-copyright__original" th:href="@{${theme.config.basics.copyrightAgreement}}"
|
||||
<a th:if="${#strings.equals(#annotations.getOrDefault(post, 'copyrightType','original'),'original') && copyrightEnable}"
|
||||
class="post-copyright__original" th:href="@{${not #strings.isEmpty(copyrightUrl) ? copyrightUrl :
|
||||
not #strings.isEmpty(theme.config.post.copyrights.originalUrl) ? theme.config.post.copyrights.originalUrl : '#'}}"
|
||||
title="该文章为原创文章,注意版权协议">原创</a>
|
||||
<a th:if="${#strings.equals(#annotations.getOrDefault(post, 'copyrightType','original'),'reprint') && copyrightEnable}"
|
||||
class="post-copyright__original" th:href="@{${not #strings.isEmpty(copyrightUrl) ? copyrightUrl :
|
||||
not #strings.isEmpty(theme.config.post.copyrights.originalUrl) ? theme.config.post.copyrights.reprintUrl : '#'}}"
|
||||
title="该文章为转载文章,版权归原作者所有">转载</a>
|
||||
<a class="post-copyright-title" href="#"><span th:text="${post.spec.title}"></span></a>
|
||||
</div>
|
||||
<div class="post-copyright__type">
|
||||
|
@ -93,8 +100,11 @@
|
|||
<i class="haofont hao-icon-paste"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="post-copyright__notice">
|
||||
<span class="post-copyright-info" th:utext="${theme.config.post.copyrights.content}"></span>
|
||||
<div class="post-copyright__notice" th:if="${copyrightEnable}">
|
||||
<span class="post-copyright-info"
|
||||
th:utext="${#strings.equals(#annotations.getOrDefault(post, 'copyrightType','original'),'reprint') ?
|
||||
theme.config.post.copyrights.reprintContent : theme.config.post.copyrights.content}">
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -72,8 +72,12 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div th:if="${theme.config.post.copyrights.enable}" class="post-copyright__notice">
|
||||
<span class="post-copyright-info" th:utext="${theme.config.post.copyrights.content}"></span>
|
||||
<div th:if="${#strings.equals(#annotations.getOrDefault(post, 'copyrightEnable','true'),'true')}"
|
||||
class="post-copyright__notice">
|
||||
<span class="post-copyright-info"
|
||||
th:utext="${#strings.equals(#annotations.getOrDefault(post, 'copyrightType','original'),'reprint') ?
|
||||
theme.config.post.copyrights.reprintContent : theme.config.post.copyrights.content}">
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,21 @@
|
|||
<div id="post-firstinfo">
|
||||
<div class="meta-firstline">
|
||||
<!-- 这里要跳转到版权页 -->
|
||||
<!--<a class="post-meta-original" th:href="@{/cc}" title="该文章为原创文章,注意版权协议">原创</a>-->
|
||||
<th:block th:with="copyrightUrl =${#annotations.get(post, 'copyrightUrl')}"
|
||||
th:if="${#strings.equals(#annotations.getOrDefault(post, 'copyrightEnable','true'),'true')}">
|
||||
<a class="post-meta-original"
|
||||
title="该文章为原创文章,注意版权协议"
|
||||
th:if="${#strings.equals(#annotations.getOrDefault(post, 'copyrightType','original'),'original')}"
|
||||
th:href="@{${not #strings.isEmpty(copyrightUrl) ? copyrightUrl :
|
||||
not #strings.isEmpty(theme.config.post.copyrights.originalUrl) ? theme.config.post.copyrights.originalUrl : '#'}}"
|
||||
>原创</a>
|
||||
<a class="post-meta-original"
|
||||
title="该文章为转载文章,版权归原作者所有"
|
||||
th:if="${#strings.equals(#annotations.getOrDefault(post, 'copyrightType','original'),'reprint')}"
|
||||
th:href="@{${not #strings.isEmpty(copyrightUrl) ? copyrightUrl :
|
||||
not #strings.isEmpty(theme.config.post.copyrights.originalUrl) ? theme.config.post.copyrights.reprintUrl : '#'}}"
|
||||
>转载</a>
|
||||
</th:block>
|
||||
<span class="post-meta-categories" th:each="category : ${post.categories}"
|
||||
th:if="${not #lists.isEmpty(post.categories)}">
|
||||
<a class="post-meta-categories" th:href="@{${category.status.permalink}}"
|
||||
|
|
Loading…
Reference in New Issue