You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过修改_quarto.yml在导航栏链接中添加自定义图标?

解决Quarto导航栏添加许可证徽章的问题

Quarto的导航栏配置不支持直接在列表项中使用Markdown格式的链接/图片,需要通过html字段插入自定义HTML代码来实现徽章图标。

正确配置示例

project:
  type: website

website:
  title: "An affordable system for the hyperspectral scanning and processing of sediment cores"
  
  navbar:
    logo: "HSILab.png"
    left:
      - href: index.qmd
        text: Home
      - about.qmd
      - href: https://creativecommons.org/licenses/by-nc-sa/2.0/
        html: '<img src="https://licensebuttons.net/i/l/by-nc-sa/ffffff/00/00/00/88x31.png" alt="Attribution-NonCommercial-ShareAlike" style="height:31px; width:88px; vertical-align: middle;">'
      - citation.qmd

配置说明

  • 用href指定徽章点击后跳转的许可证页面地址
  • 用html字段插入包含图片的HTML代码,通过style属性调整图标与导航栏文字的垂直对齐,避免排版错乱
  • 替换原有的license.qmd条目即可完成替换

内容的提问来源于stack exchange,提问作者user2955884

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 15:05:12