Skip to content
This repository has been archived by the owner on Jul 2, 2022. It is now read-only.

Support copyright to every post #170

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,5 +226,10 @@ favicon: /img/favicon.png
# rss文件
rss: atom.xml

# 版权信息,要使用版权信息可以在这配置并设定许可方式,可以从 https://creativecommons.org/about/cclicenses/ 查询
copyright:
enable: false
license: "CC BY-NC-ND"

```

5 changes: 5 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,8 @@ favicon: /img/favicon.png

# rss文件
rss: atom.xml

# 要使用版权信息可以在这配置并设定许可方式,可以从 https://creativecommons.org/about/cclicenses/ 查询
copyright:
enable: false
license: "CC BY-NC-ND"
5 changes: 5 additions & 0 deletions languages/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ tag: Tag
nav.category: Category
nav.tag: Tag
nav.archive: Archive
copyright:
author: "Author: "
title: "title: "
link: "Link: "
license_title: "License: "
5 changes: 5 additions & 0 deletions languages/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ tag: Tag
nav.category: 分类
nav.tag: 标签
nav.archive: 归档
copyright:
author: "作者: "
title: "标题: "
link: "链接: "
license_title: "版权声明: "
18 changes: 13 additions & 5 deletions languages/zh-TW.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,18 @@ archive_a: 彙整
archive_b: 彙整:%s
page: 第 %d 頁
recent_posts: 最新文章
newer: Newer
older: Older
share: Share
newer: 較新
older: 較舊
share: 分享
powered_by: Powered by
rss_feed: RSS Feed
category: Category
tag: Tag
category: 分類
tag: 標籤
nav.category: 分類
nav.tag: 標籤
nav.archive: 彙整
copyright:
author: "作者: "
title: "文章標題: "
link: "文章連結: "
license_title: "版權聲明: "
5 changes: 4 additions & 1 deletion layout/_partial/post/article.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@
</ul>
<%}%>
</div>
<% if (theme.copyright.enable){ %>
<%- partial("_partial/copyright") %>
<% } %>
<%- partial('gitalk', {post: page}) %>
</div>
<% if (theme.TOC == true){ %>
<div class="side">
<%- toc(page.content, {list_number: true}) %>
<%- toc(page.content, {list_number: true}) %>
</div>
<%}%>
</div>
Expand Down
75 changes: 75 additions & 0 deletions layout/_partial/post/copyright.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<div>
<ul class="post-copyright">
<li class="post-copyright-author">
<strong><%= __('copyright.author') %> </strong><%= config.author%></a>
</li>
<li class="post-copyright-title">
<strong><%= __('copyright.title') %> </strong>
<%- page.title%>
</li>
<li class="post-copyright-link">
<strong><%= __('copyright.link') %> </strong>
<a href="<%- url_for(page.path) %>" target="_blank" title="<%- page.title %>"><%- config.url %><%- url_for(page.path) %></a>
</li>
<li class="post-copyright-license">
<strong><%= __('copyright.license_title') %> </strong>

<% if (theme.copyright.license.toUpperCase() === "CC BY"){ %>
<a
rel="license"
href="https://creativecommons.org/licenses/by/4.0/"
target="_blank" title="Attribution 4.0 International (CC BY 4.0)"
>
CC BY 4.0
</a>

<% } else if (theme.copyright.license.toUpperCase() === "CC BY-SA"){ %>
<a
rel="license"
href="https://creativecommons.org/licenses/by-sa/4.0/"
target="_blank" title="Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)"
>
CC BY-SA 4.0
</a>

<% } else if (theme.copyright.license.toUpperCase() === "CC BY-NC"){ %>
<a
rel="license"
href="https://creativecommons.org/licenses/by-nc/4.0/"
target="_blank" title="Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)"
>
CC BY-NC 4.0
</a>

<% } else if (theme.copyright.license.toUpperCase() === "CC BY-NC-SA"){ %>
<a
rel="license"
href="https://creativecommons.org/licenses/by-nc-sa/4.0/"
target="_blank" title="Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)"
>
CC BY-NC-SA 4.0
</a>

<% } else if (theme.copyright.license.toUpperCase() === "CC BY-ND"){ %>
<a
rel="license"
href="https://creativecommons.org/licenses/by-nd/4.0/"
target="_blank" title="Attribution-NoDerivatives 4.0 International (CC BY-ND 4.0)"
>
CC BY-ND 4.0
</a>

<% } else { %>
<a
rel="license"
href="https://creativecommons.org/licenses/by-nc-nd/4.0/"
target="_blank"
title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)"
>
CC BY-NC-ND 4.0
</a>

<% } %>
</li>
</ul>
<div>