其他修改Hexo Next主题页脚备案
翱翔大使
此方法比较暴力,只适合临时用
或者只需要萌备案
可以参考。
已参照官方文档重写了页脚,萌备案请参考新发布的文章。
查看文章
将代码:
footer.njk1 2 3 4 5 6 7 8 9 10 11
| {%- if theme.footer.beian.enable %} <div class="beian"> {{- next_url('https://beian.miit.gov.cn', theme.footer.beian.icp + ' ') }} {%- if theme.footer.beian.gongan_icon_url %} <img src="{{ url_for(theme.footer.beian.gongan_icon_url) }}" alt=""> {%- endif %} {%- if theme.footer.beian.gongan_id and theme.footer.beian.gongan_num %} {{- next_url('https://beian.mps.gov.cn/#/query/webSearch?code=' + theme.footer.beian.gongan_id, theme.footer.beian.gongan_num + ' ') }} {%- endif %} </div> {%- endif %}
|
修改为:
footer.njk1 2 3 4 5 6 7 8 9 10
| {%- if theme.footer.beian.enable %} <div class="beian"> {%- if theme.footer.beian.gongan_icon_url %} <img src="{{ url_for(theme.footer.beian.gongan_icon_url) }}" alt=""> {%- endif %} {%- if theme.footer.beian.gongan_id and theme.footer.beian.gongan_num %} {{- next_url('https://icp.gov.moe/?keyword=' + theme.footer.beian.gongan_id, theme.footer.beian.gongan_num + ' ') }} {%- endif %} </div> {%- endif %}
|
修改Next
主题的_config.yml
将属性:
_config.yml1 2 3 4 5 6
| beian: enable: false icp: gongan_id: gongan_num: gongan_icon_url:
|
修改为:
_config.yml1 2 3 4 5 6
| beian: enable: true gongan_id: XXXXXXXX gongan_num: 萌ICP备XXXXXXXX号 gongan_icon_url:
|
添加萌备案的图标(可选)
- 下载图标包,将
moe-icon
文件夹解压到source
文件夹下。
- 打开
Next
主题footer的样式文件,修改页脚icon大小,参考路径:
themes\hexo-theme-next\layout_partials\footer.njk
- 搜索
if (hexo-config('footer.beian.enable') and hexo-config('footer.beian.gongan_icon_url'))
。
- 将这段代码修改成以下这样(其实只是设定了下图标大小):
footer.njk1 2 3 4 5 6 7 8 9
| if (hexo-config('footer.beian.enable') and hexo-config('footer.beian.gongan_icon_url')) { .beian img { display: inline-block; margin: 0 3px; vertical-align: middle; width: 20px; height: 20px; } }
|
- 在上一步中的属性
gongan_icon_url
中添加./moe-icon/icon120.png
。
- 完成。