2023-11-21 hexo next主题 如何在博客网站底部添加备案号
主题:NexT.Pisces v5.1.4
找到路径:博客目录名称\themes\hexo-theme-next\layout\_partials
找到文件:footer.swig,并在里面添加备案号,如图:
未改变前:
<div class="copyright">{# #}{% set current = date(Date.now(), "YYYY") %}{# #}© {% if theme.footer.since and theme.footer.since != current %}{{ theme.footer.since }} — {% endif %}{# #}<span itemprop="copyrightYear">{{ current }}</span> <span class="with-love"> <i class="fa fa-{{ theme.footer.icon }}"></i> </span> <span class="author" itemprop="copyrightHolder">{{ theme.footer.copyright || config.author }}</span> {% if theme.post_wordcount.totalcount %} <span class="post-meta-divider">|</span> <span class="post-meta-item-icon"> <i class="fa fa-area-chart"></i> </span> {% if theme.post_wordcount.item_text %} <span class="post-meta-item-text">{{ __('post.totalcount') }}:</span> {% endif %} <span title="{{ __('post.totalcount') }}">{# #}{{ totalcount(site, '0,0.0a') }}{# #}</span> {% endif %} </div>
改变后:
<div class="copyright">{# #}{% set current = date(Date.now(), "YYYY") %}{# #}© {% if theme.footer.since and theme.footer.since != current %}{{ theme.footer.since }} — {% endif %}{# #}<span itemprop="copyrightYear">{{ current }}</span> <span class="with-love"> <i class="fa fa-{{ theme.footer.icon }}"></i> </span> <span class="author" itemprop="copyrightHolder">{{ theme.footer.copyright || config.author }}</span> {% if theme.post_wordcount.totalcount %} <span class="post-meta-divider">|</span> <span class="post-meta-item-icon"> <i class="fa fa-area-chart"></i> </span> {% if theme.post_wordcount.item_text %} <span class="post-meta-item-text">{{ __('post.totalcount') }}:</span> {% endif %} <span title="{{ __('post.totalcount') }}">{# #}{{ totalcount(site, '0,0.0a') }}{# #}</span> {% endif %} <a href="http://beian.miit.gov.cn">粤ICP备xxx号</a> </div>
对,就是在copyright类的最后一处添加备案号链接。
注:备案链接不要添加www,不然有可能404(来自网友)。