谢谢!我还找到了这篇帖子:在主题中用自定义图标替换 Discourse 的默认 SVG 图标
最终,我直接将 SVG 精灵嵌入到 Header 文件中,因为按照那篇文章所述上传并重命名对我无效(当然,也可能是我操作有误)。
所以我的 Header 是这样的:
<svg width="0" height="0" class="hidden" style="display: none;">
<symbol id="myicon-search" ..... </symbol>
<!-- 我所有的符号都在这里... -->
</svg>
<script type="text/discourse-plugin" version="0.8">
api.replaceIcon('search', 'myicon-search');
</script>
这样管理起来很方便。
我使用 https://svgsprit.es 上的 SVG 精灵生成器来确保格式正确。