Cactus博客添加版权声明

  |  

一、开始

新建文件Declare.ejs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!-- 添加版权声明 -->
<!-- themes\cactus\layout\_partial\post\declare.ejs -->
<% if ((theme.declare.declare_type === 2 || (theme.declare.declare_type === 1 && page.declare))){ %>
<div class="declare" style="padding-left:2px;color: #1e90ff;font-size: 14px;font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: rgba(29,31,33,1);border:dotted aliceblue 1px; border-radius: 1%;">
<strong class="author" style="color: #eeeeee;">本文作者:</strong>
<% if(config.author != undefined){ %>
<%= config.author%>
<% }else{%>
<font color="red">请在博客根目录“_config.yml”中填入正确的“author”</font>
<%}%>
<br>
<strong class="create-time" style="color: #eeeeee;">发布时间:</strong>
<%- date(page.date, 'YYYY-MM-DD') %>
<br>
<strong class="update-time" style="color: #eeeeee;">最后更新:</strong>
<%- date(page.updated, 'YYYY-MM-DD') %>
<br>
<strong class="article-titles" style="color: #eeeeee;">本文标题:</strong>
<%= page.title %>
<br>
<strong class="article-url" style="color: #eeeeee;">本文链接:</strong>
<a href="<%= config.url %>/<%= page.path %>" title="<%= page.title %>" target="_blank"><%= config.url %>/<%= page.path %></a>
<br>
<strong class="copyright" style="color: #eeeeee;">版权声明:</strong>
<span>本作品采用</span>
<a rel="license" href="<%= theme.declare.licensee_url%>" title="<%= theme.declare.licensee_alias %>" style="color: #eeeeee;font-size: 13px;font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;"><%= theme.declare.licensee_name%></a>
<span>许可协议进行许可。转载请注明出处!</span>
<% if(theme.declare.licensee_img != undefined){ %>
<br>
<a rel="license" href="<%= theme.declare.licensee_url%>"><img alt="知识共享许可协议" style="border-width:0;margin-left: 0%;" src="<%= theme.declare.licensee_img%>"/></a>
<% } %>
<div class="svgcc" style="margin-left: 81.1%;margin-top: -24.2%;position:absolute;clip:rect(25px 130px 150px 0px)">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512" width="150px" height="150px"><path fill="#cccccc" d="M245.8 214.9l-33.2 17.3c-9.4-19.6-25.2-19.9-27.5-19.9-22.1 0-33.2 14.6-33.2 43.8 0 23.6 9.2 43.8 33.2 43.8 14.5 0 24.7-7.1 30.6-21.3l30.6 15.5c-6.2 11.5-25.7 39-65.1 39-22.6 0-74-10.3-74-77.1 0-58.7 43-77.1 72.6-77.1 30.7 0 52.7 12 66 35.9zm143.1 0l-32.8 17.3c-9.5-19.8-25.7-19.9-27.9-19.9-22.1 0-33.2 14.6-33.2 43.8 0 23.6 9.2 43.8 33.2 43.8 14.5 0 24.7-7.1 30.5-21.3l31 15.5c-2.1 3.8-21.4 39-65.1 39-22.7 0-74-9.9-74-77.1 0-58.7 43-77.1 72.6-77.1 30.7 0 52.6 12 65.6 35.9zM247.6 8.1C104.7 8.1 0 123.1 0 256.1c0 138.5 113.6 248 247.6 248 129.9 0 248.4-100.9 248.4-248 0-137.9-106.6-248-248.4-248zm.9 450.8c-112.5 0-203.7-93-203.7-202.8 0-105.4 85.4-203.3 203.7-203.3 112.5 0 202.8 89.5 202.8 203.3 0 121.7-99.7 202.8-202.8 202.8z"/></svg>
</div>
</div>
<% } else {%>
<div class="declare" hidden="hidden"></div>
<% } %>

编辑Post.ejs文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<!-- themes\cactus\layout\post.ejs -->
<article class="post h-entry" itemscope itemtype="http://schema.org/BlogPosting">
<header>
<%- partial('_partial/post/title', { post: page, index: false, class_name: 'posttitle' }) %>
<div class="meta">
<span class="author p-author h-card" itemprop="author" itemscope itemtype="http://schema.org/Person">
<span class="p-name" itemprop="name"><% if (page.author) { %><%- page.author %><% } else { %><%- config.author %><% } %></span>
</span>
<%- partial('_partial/post/date', { post: page, class_name: 'postdate' }) %>
<%- partial('_partial/post/category') %>
<%- partial('_partial/post/tag') %>
<!-- 字数统计 -->
<% if (theme.word_count && !page.no_word_count) { %>
<%- partial('_partial/post/word') %>
<% } %>
</div>
</header>
<%- partial('_partial/post/gallery') %>
<div class="content e-content" itemprop="articleBody">
<%- page.content %>
<!-- 添加版权声明 -->
<% if(theme.declare){%>
<%- partial('_partial/post/declare') %>
<% } %>
</div>
</article>
<%- partial('_partial/comments') %>

编辑_config.yml

1
2
3
4
5
6
7
8
9
# 版权声明
#在需要进行版权声明的文章的md文件头部,设置属性declare: true。
#版权基础设定:0-关闭声明; 1-文章对应的md文件里有declare: true属性,才有版权声明; 2-所有文章均有版权声明
declare:
declare_type: 2
licensee_url: https://creativecommons.org/licenses/by-nc-nd/4.0/ #当前应用的版权协议地址。
licensee_name: 'CC BY-NC-ND 4.0' #版权协议的名称
licensee_alias: '知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议' # alias别名
# licensee_img: https://i.creativecommons.org/l/by-nc-nd/4.0/88x31.png #版权协议的Logo

二、完结撒花

CC协议

本文作者: Seyou
发布时间: 2024-03-22
最后更新: 2024-03-23
本文标题: Cactus博客添加版权声明
本文链接: https://seyou.lol/posts/2024/03/d0471af9.html
版权声明: 本作品采用 CC BY-NC-ND 4.0 许可协议进行许可。转载请注明出处!