hexo-next在文章下添加版权信息


修改主题目录下的_config.yml文件

themes/next/_config.yml

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:

post的值改为true表示文章开启添加版权信息。

单独设置文章版权

打开themes/next/layout/_macro/post.swig
找到creative_commons那一行改为:

1
2
3
{%- if theme.creative_commons.license and theme.creative_commons.post and page.copyright %}
{{ partial('_partials/post/post-copyright.swig') }}
{%- endif %}

就是添加了 page.copyright ,这样就可以单独控制某篇文章是否添加版权信息了。

可以修改模板文件,这样默认就有 copyright: true

模板文件在scaffolds/post.md

参考

hexo next主题给文章添加版权信息