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