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

发布时间:
更新时间:
👀 阅读量:

cp1

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

themes/next/_config.yml

## 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那一行改为:

{%- 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主题给文章添加版权信息

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

作者: xingwangzhe

本文链接: https://xingwangzhe.fun/posts/50aa0545

本文采用 知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议 进行许可。

留言评论

2000年1月1日星期六
00:00:00