Next -17- 添加文章版权声明

本文最后更新于:2022年7月6日 下午

本文介绍Next 7.7.1 主题添加版权声明的方法。

修改主题配置文件

开启版权需要 license 不为false 并且 post 不为 false,我们在此把 post 设置为 true 就好:

1
2
3
4
5
6
7
8
9
10
# Creative Commons 4.0 International License.
# See: https://creativecommons.org/share-your-work/licensing-types-examples
# Available values of license: by | by-nc | by-nc-nd | by-nc-sa | by-nd | by-sa | zero
# You can set a language value if you prefer a translated version of CC license, e.g. deed.zh
# CC licenses are available in 39 languages, you can find the specific and correct abbreviation you need on https://creativecommons.org
creative_commons:
license: by-nc-sa
sidebar: false
post: true
language:

尝试通过修改设定更改语言失败了。

实现效果

xiaoguo

进阶升级

如果不想使用英文版只好手动更改源码,将themes/next/layout/_partials/post/post-copyright.swig文件内容替换为:

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
{%- set ccIcon = '<i class="fa fa-fw fa-creative-commons"></i>' %}
{%- set ccText = theme.creative_commons.license | upper %}

<div>
<ul class="post-copyright">
<li class="post-copyright-author">
<span><strong>本文标题&nbsp:&nbsp&nbsp</strong>{{ page.title }}<br></span>
<span><strong>文章作者&nbsp:&nbsp&nbsp</strong>{{ theme.author }}<br></span>
<span><strong>发布时间&nbsp:&nbsp&nbsp</strong>{{ page.date.format("YYYY年MM月DD日 - HH:mm:ss") }}<br></span>
<span><strong>最后更新&nbsp:&nbsp&nbsp</strong>{{ page.updated.format("YYYY年MM月DD日 - HH:mm:ss") }}<br></span>
<span><strong>原始链接&nbsp:&nbsp&nbsp</strong><a href="{{ url_for(page.path) }}" title="{{ page.title }}">{{ page.permalink }}</a><br></span>
<span><strong>许可协议&nbsp:&nbsp&nbsp</strong><i class="fa fa-creative-commons"></i> <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)">署名-非商业性使用-禁止演绎 4.0 国际</a> 转载请保留原文链接及作者<br></span>

<!-- <strong>{{ __('post.copyright.author') + __('symbol.colon') }} </strong>
{{- page.author or author }}
</li>
<li class="post-copyright-link">
<strong>{{ __('post.copyright.link') + __('symbol.colon') }}</strong>
{{ next_url(page.permalink, page.permalink, {title: page.title}) }}
</li>
<li class="post-copyright-license">
<strong>{{ __('post.copyright.license_title') + __('symbol.colon') }} </strong>
{{- __('post.copyright.license_content', next_url(ccURL, ccIcon + ccText)) }}
</li>-->
</ul>
</div>

新版效果


Next -17- 添加文章版权声明
https://www.zywvvd.com/notes/hexo/theme/next/17-next-add-copyright/add-copyright/
作者
Yiwei Zhang
发布于
2020年3月23日
许可协议