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

添加Google Fonts字体时出现'expected named entity'错误的修复咨询

修复Google Fonts引入时的"expected named entity, got none"错误

这个报错的核心原因是HTML语法要求:&作为特殊字符必须转义为&,你复制的代码最后一行URL里的&display=swap没有做转义,导致HTML解析器无法识别,抛出实体错误。

修复后的代码如下:

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Josefin+Sans:ital,wght@0,100..700;1,100..700&amp;display=swap" rel="stylesheet">

只需将原代码中URL里的&替换为&amp;即可解决问题,HTML解析器会正确处理转义后的字符,不再报错。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.13 00:04:50