HTML文档中的非HTML标签是否对SEO不利? [英] Are Non-HTML tags in a HTML document bad for SEO?

查看:93
本文介绍了HTML文档中的非HTML标签是否对SEO不利?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在页面上使用非HTML标签是一种不好的做法吗?我需要将它们用于内部内容处理需求,并想知道它是否有任何问题(例如SEO)?

Is it a bad practice have non-HTML tags of the page? I need to use them for internal content processing needs and wonder if there are any troubles with it (SEO for example)?

推荐答案

是的,这很糟糕.不是特别针对SEO,而是针对浏览器.您依靠浏览器来忽略标签并正确呈现页面.由于每个渲染引擎加载页面的方式略有不同,因此您无法知道页面将如何处理错误的html.

Yes it is bad. Not particularly for SEO but for browsers. You are relying on the browser to ignore your tags and render the page correctly. Since every rendering engine loads a page slightly differently, you have no way of knowing how it will handle your bad html.

可以将它们包装在html注释中吗?像这样:

Can you wrap them in html comments? Like so:

<!--<not a real tag>-->

浏览器和蜘蛛程序将忽略它们,但是由于它们仍然是html的一部分,因此解析器可能仍然能够读取它们.

The browser and spiders will ignore these but since they are still part of the html, your parser might still be able to read them.

一种替代方法是使用 HTML5的自定义数据属性.您的解析器也应该能够读取这些内容.

An alternative is to use HTML5's custom data attributes. Your parser should also be able to read these.

W3C还具有实验性的自定义元素规范.当前浏览器支持看起来很差,但是将来可能会引起人们的兴趣.

W3C also have an experimental custom elements spec. Browser support looks poor at present but this may be of interest in future.

这篇关于HTML文档中的非HTML标签是否对SEO不利?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆