CSS 使用 display:none 隐藏的 h1 标签是否被搜索引擎突出显示?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/753951/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is h1 tag that's hidden using display:none given prominence by search engines?
提问by Iris
When content is hidden by CSS (display:none), is that read by Search engines or are sites penalised for that ? In my case, due to some CMS and other reasons, I need to serve alternative content to users and hide the H1 tag on the page using display:none. I wanted to know if the Search Engine will still treat the H1 tag with the same prominence as when its not hidden.
当内容被 CSS (display:none) 隐藏时,是被搜索引擎读取还是网站会因此受到惩罚?就我而言,由于某些 CMS 和其他原因,我需要向用户提供替代内容并使用 display:none 在页面上隐藏 H1 标签。我想知道搜索引擎是否仍会以与未隐藏时相同的显着性对待 H1 标签。
回答by Bjorn
It's against Google's policy. It's called keyword stuffing and will get you delisted from Google, which means your site wont even show up on Google anymore. A good rule of thumb is to only show googlebot what users of your site can perceive display.
这违反了谷歌的政策。这称为关键字填充,会使您从 Google 中除名,这意味着您的网站甚至不会再出现在 Google 上。一个好的经验法则是只向 googlebot 显示您网站的用户可以看到的内容。
If you show the information to people at some point, then you can argue you're not keyword stuffing I guess, but Google will delist you first and then you'll have to file an appeal.
如果你在某个时候向人们展示信息,那么你可以争辩说你不是关键字填充,但谷歌会先将你除名,然后你必须提出上诉。
回答by Chad Birch
I don't believe that Google will penalize you automatically (meaning without human review), but it's definitely a risk, especially if the hidden text appears to be that way solely for SEO purposes.
我不相信谷歌会自动惩罚你(意思是没有人工),但这绝对是一种风险,特别是如果隐藏文本似乎只是为了 SEO 目的。
回答by Guffa
Search engine builders have had about 15 years to learn every trick that people use to get better search engine ratings, so you can be sure that the robots notice something simple like hidden text.
搜索引擎构建者花了大约 15 年的时间来学习人们用来获得更好的搜索引擎评级的每一个技巧,所以你可以确定机器人会注意到一些简单的东西,比如隐藏的文本。
If the header tag is not visible on the page, it's pointless to have it there at all. At best the search engines will ignore the tag. At worst they will ignore your site.
如果页眉标签在页面上不可见,则根本没有意义。搜索引擎充其量会忽略该标签。最坏的情况是他们会忽略您的网站。
回答by Alister Bulman
Search engines are getting wise with regard to CSS techniques to hide information in attempts to game them. There is likely to be a threshold however, so one or two such techniques, for valid enough reasons won't be too problematic for you. If you can, do try to avoid them, and especially en-mass.
搜索引擎越来越明智地使用 CSS 技术来隐藏信息以试图操纵它们。然而,可能会有一个门槛,所以一两个这样的技术,出于足够充分的理由,对你来说不会有太大问题。如果可以,请尽量避免它们,尤其是集体。
回答by Matthew James Taylor
There is no reason why you can't hide the H1 tag - it's not necessarily a bad thing. Vision impaired people who are reading your website with a screen reader would find the hidden H1 useful regardless if it's hidden (because most screen readers read the HTML not the visual page). Also if you visually have a business logo on the page and then have a hidden H1 with the business name, this is also fine. In this case the H1 is an alternative to the Logo so it is therefore fine for purely semantic reasons.
没有理由不能隐藏 H1 标签——这不一定是件坏事。使用屏幕阅读器阅读您网站的视障人士会发现隐藏的 H1 很有用,无论它是否隐藏(因为大多数屏幕阅读器阅读 HTML 而非视觉页面)。此外,如果您在页面上视觉上有一个企业标志,然后有一个带有企业名称的隐藏 H1,这也很好。在这种情况下,H1 是 Logo 的替代品,因此纯粹出于语义原因,它是可以的。
Also you can have hidden content that can 'appear' by user interaction (say clicking on a 'more' link). This is also fine. Hiding text is not wrong providing there is a good, usability reason for doing it. Of course keyword stuffing is wrong and this should never be done - so an SEO reason is never enough alone to hide text - there must be some other reason.
您也可以拥有可以通过用户交互“出现”的隐藏内容(比如点击“更多”链接)。这也很好。隐藏文本并没有错,前提是有一个很好的、可用性的原因。当然,关键字填充是错误的,永远不应该这样做-因此仅靠 SEO 原因永远不足以隐藏文本-必须有其他原因。
回答by viam0Zah
As already mentioned, it is not a good idea to hide information for many purposes.
如前所述,出于多种目的隐藏信息并不是一个好主意。
If actually, what you really want is to serve visitors an alternate media than plain text, there are a lot of ways to do that, just see Nine Techniques for CSS Image Replacementfor further details, or sIFR.
如果实际上,您真正想要的是为访问者提供替代媒体而不是纯文本,那么有很多方法可以做到这一点,请参阅CSS 图像替换的九种技术以获取更多详细信息,或sIFR。
回答by Gavin Miller
You're better off not doing this.
你最好不要这样做。
Search Engines like Google are smart and they check for this type of thing and when you're caught, you'll get flagged and your SEO is useless.
像谷歌这样的搜索引擎很聪明,他们会检查这种类型的东西,当你被抓住时,你会被标记,你的 SEO 毫无用处。
Work within the system, don't try to cheat it. Google offers a ton of toolsfor developers looking to do legitimate SEO.
在系统内工作,不要试图欺骗它。Google 为希望进行合法 SEO 的开发人员提供了大量工具。
回答by olefredrik
Using a .visuallyhidden
class might be a better idea than the good old display:none;
Screen readers will read the content in .visuallyhidden
as if it were plain text.
使用.visuallyhidden
类可能比好的旧display:none;
屏幕阅读器更好地阅读内容,.visuallyhidden
就像它是纯文本一样。
.visuallyhidden {
border: 0 none;
clip: rect(0px, 0px, 0px, 0px);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
I'm not sure if Google penalizes the use of such classes in h1
tags. But in any case I think it is a better option than using display: none;
我不确定 Google 是否会惩罚在h1
标签中使用此类类。但无论如何,我认为这是比使用更好的选择display: none;
回答by Justin
you can set the background to the as the image you want people to see and then text indent the text to -9999px.
您可以将背景设置为您希望人们看到的图像,然后将文本缩进为 -9999px。
回答by Rahul Prasad
Its not a discussion about that search engine should consider it or not. Its a question about what search engine will do. Here is your answer http://support.google.com/webmasters/bin/answer.py?hl=en&answer=66353
这不是关于该搜索引擎是否应该考虑的讨论。这是一个关于搜索引擎会做什么的问题。这是您的答案 http://support.google.com/webmasters/bin/answer.py?hl=zh-CN&answer=66353
Search engine will discard it, and also its against their terms of use so they have right to even remove your site from search result.
搜索引擎将丢弃它,并且这违反了他们的使用条款,因此他们甚至有权从搜索结果中删除您的网站。