本文介绍Next 7.7.1 主题添加版权声明的方法。
开启版权需要 license 不为false 并且 post 不为 false,我们在此把 post 设置为 true 就好:
# 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:
尝试通过修改设定更改语言失败了。
如果不想使用英文版只好手动更改源码,将
themes/next/layout/_partials/post/post-copyright.swig
文件内容替换为:
{%- 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>本文标题 :  </strong>{{ page.title }}<br></span>
<span><strong>文章作者 :  </strong>{{ theme.author }}<br></span>
<span><strong>发布时间 :  </strong>{{ page.date.format("YYYY年MM月DD日 - HH:mm:ss") }}<br></span>
<span><strong>最后更新 :  </strong>{{ page.updated.format("YYYY年MM月DD日 - HH:mm:ss") }}<br></span>
<span><strong>原始链接 :  </strong><a href="{{ url_for(page.path) }}" title="{{ page.title }}">{{ page.permalink }}</a><br></span>
<span><strong>许可协议 :  </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>