hexo笔记七:next主题添加版权声明

版权声明是指在文末加上这么一段文字:
在这里插入图片描述
本文记录如何添加文章的版权声明
1 编辑主题配置文件:

cd 博客目录
vim themes/next/_config.yml

# 找到下列信息设置为true,许可协议用默认的就行了。
# Declare license on posts
post_copyright:
  enable: true
  license: CC BY-NC-SA 3.0
  license_url: https://creativecommons.org/licenses/by-nc-sa/3.0/

2 编辑博客配置文件:

cd 博客目录
vim _config.yml

# 一定要设置url信息,否则版权声明中的文章地址信息是错误的
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://自己的域名或者ip地址

3 重新生成博客:

cd 博客目录
hexo g

然后就可以看到版权声明信息了。

当然,前提是你的文章写的好才有转载的价值,不然别人就算搞盗版抄袭也看不上你的文章,那就然并卵了。。。

===================================
更新,加个小彩蛋:

在每篇文章结束后,加上这么一行。
在这里插入图片描述
1 在路径 themes/next/layout/_macro 中新建 passage-end-tag.swig 文件,并添加以下内容:

<div>
    {% if not is_index %}
        <div style="text-align:center;color: #ccc;font-size:14px;">-------------本文结束<i class="fa fa-paw"></i>感谢您的阅读-------------</div>
    {% endif %}
</div>

2 接着打开themes\next\layout_macro\post.swig文件,在post-body之后,post-footer 之前添加如下代码:

<div>
  {% if not is_index %}
    {% include 'passage-end-tag.swig' %}
  {% endif %}
</div>

具体位置如下
在这里插入图片描述
3 打开主题配置文件,在末尾添加:

cd 博客目录
vim theme/next/_config.yml

# 文章末尾添加“本文结束”标记
passage_end_tag:
  enabled: true

猜你喜欢

转载自blog.csdn.net/Awt_FuDongLai/article/details/107430942