灯塔假旗

问题描述

我通过 web.dev 对我的网站进行了 Lighthouse 测试,结果显示了 2 个我无法完全理解的“错误”。

第一点:“表单元素没有关联的标签”。
Lighthouse 认为我没有将标签用于表格。但是,我的代码中有以下内容

<input id="burger" type="checkBox" />
<label for="burger">

这是我唯一一次使用 input
那为什么会出现这条消息呢?

第二点:“robots.txt 无效”。
我的 robots.txt 文件使用以下内容

User-agent: *
disallow: /testlab/
disallow: /en/page-not-found.htm
disallow: /en/page-not-found.htm

User-agent: WebReaper
User-agent: Webcopier
User-agent: Offline Explorer
User-agent: httrack
User-agent: Microsoft.URL.Control
User-agent: EmailCollector
User-agent: penthesilea
disallow: /

sitemap: https://link-to-sitemap.com

据我所知,内容应该被不同的爬虫识别。
那为什么我认为这是 Lighthouse 测试中的错误

这是网站的链接,如果您想自己运行测试:https://type-error.netlify.app

提示:我已经通过 netlify.toml 文件设置了重定向标题,也许这会有所帮助。

编辑:使用 Chrome 开发工具运行 Lighthouse 测试时,robots.txt 的更多信息显示:“Lighthouse 无法下载 robots.txt 文件”。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)