警惕 AI 挖坑!修复 Hexo Anzhiyu 搜索框表单报错的真实记录1. 发现问题:烦人的黄色警告在使用 Hexo 博客的 Anzhiyu 主题时,打开浏览器开发者工具(F12)的控制台,经常会看到本地搜索功能的输入框抛出以下警告:
A form field element should have an id or name attributeA form field element has neither an id nor a name attribute. This might prevent the browser from correctly autofilling the form.
虽然不影响正常搜索,但由于表单元素(<input>)缺少 id 或 name 属性,导致浏览器无法提供自动填充功能,也不符合无障碍访问(a11y)标准。为了让代码更规范,我决定修复它。
2. 第一次尝试:AI 给出的“坑爹”方案我随手将报错丢给了代码编辑器里的 AI 助手(Claude Haiku 4.5),AI 迅速帮我定位到了 themes/anzhiyu/layou ...
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
Quick StartCreate a new post1$ hexo new "My New Post"
More info: Writing
Run server1$ hexo server
More info: Server
Generate static files1$ hexo generate
More info: Generating
Deploy to remote sites1$ hexo deploy
More info: Deployment


















