date:
updated:

解决配置next主题时icons丢失的问题


① 配置菜单,如「首页」、「分类」、「标签」等这些菜单旁边的图标没显示,而都显示成问号:
如下图所示:

wrong_icons1

② 以及「友情链接」图标的设置官方文档包括网上文章写的都是如下:

wrong_icons2

多方查询后才知道,原因出在这里:
blog\themes\next\_config.yml即主题的配置文件修改出错:

menu:
  home: /
  about: /about
  tags: /tags
  categories: /categories
  archives: /archives

social:
  GitHub: https://github.com/han-sdust
  E-mail: mailto:hanluyang98@foxmail.com

这是按照一篇网上的文章修改的(网上很多文章都要求将后面的注释删掉,甚至官方文档都是这样写的)

但是事实上这个不是注释
而是指定图标的类型,是不能删除的,因此正确的配置方法是这样的:

1
2
3
4
5
6
7
8
9
10
menu:
home: / || home
about: /about/ || user
tags: /tags/ || tags
categories: /categories/ || th
archives: /archives/ || archive

social:
GitHub: https://github.com/han-sdust || github
E-mail: mailto:hanluyang98@foxmail.com || envelope

实际上在操作时,我还遇到了另一个问题,图标恢复后,对应的按钮会失效,打开地址会变为/menu%20/,从而找不到页面

这个问题是空格导致的,这样就可以了

1
2
3
4
5
6
menu:
home: /|| home
about: /about|| user
tags: /tags|| tags
categories: /categories|| th
archives: /archives|| archive

结果:
right_icons3
right_icons4


← Prev 如何搭建DHCP服务器 | markdown_code Next →
打赏
支付宝 | Alipay
微信 | WeChat