简体   繁体   English

内联CSS和JavaScript真的会影响网站SEO吗?

[英]Does inline CSS and JavaScript really affect site SEO?

内联CSS和JavaScript真的会影响网站SEO吗?

Hardly. 几乎不。 What counts for a search engine is textual content, it will filter out everything else. 搜索引擎的重要性在于文本内容,它会过滤掉其他所有内容。

I assume CSS comes into play with search engines when they determine whether a portion of text is visible on the page, or hidden for the purposes of SEO. 我认为当CSS确定一部分文本在页面上是可见的,还是为SEO目的而隐藏时,CSS会与搜索引擎发挥作用。 But even there, whether the CSS inline or in a style sheet won't make a difference. 但即使在那里,CSS内联或样式表也不会有所作为。

One could argue that the more CSS and JS a page contains, the less weight do search terms have on that page. 有人可能会争辩说,一个页面包含的CSS和JS越多,搜索术语在该页面上的权重就越小。 But I think that argument is invalid, because any non-content content will simply be ignored altogether. 但我认为这个论点是无效的,因为任何非内容内容都会被完全忽略。

Answered and voted for by true developers. 由真正的开发人员回答并投票赞成。

In-line CSS will contribute to the payload of the page and that affects the load speed. 内嵌CSS将有助于页面的有效负载,并影响加载速度。 Load speed is one of many ranking factors so it's almost an impossible question to answer conclusively. 加载速度是许多排名因素之一,因此最终无法回答这个问题。

The text to code ratio also plays a role. 文本与代码比率也起着重要作用。 Tons of code to render a few lines of visible text means that search engines need to dig deeper to find the content relevancy in pages. 用于呈现几行可见文本的大量代码意味着搜索引擎需要深入挖掘以找到页面中的内容相关性。 Matt Cutts has alluded to this a few times. Matt Cutts曾多次暗示这一点。

While search engines may ignore comments and in-line css/js the bandwidth, processing and storage logistics may be motivation enough to dampen the SEO performance to some degree on heavy in-line css pages. 虽然搜索引擎可能会忽略评论和内联css / js,但带宽,处理和存储物流可能足以在某种程度上抑制重型在线CSS页面的SEO性能。

Personally I use in-line code only when absolutely page specific scenarios require it and even then I use css compression tools to reduce white space in the documents when ready for production. 就个人而言,我只在绝对特定于页面的场景需要时才使用内嵌代码,即使这样我还是使用css压缩工具来减少准备生产时文档中的空白区域。

I have had this conversation on many occasions and no neither side is conclusive. 我曾经多次进行过这次谈话,但没有任何一方能够得出结论。 My simple answer is, if it "could" be detrimental then why risk it. 我的简单回答是,如果它“可能”有害,那么为什么要冒风险呢。

I don't think most spiders actually execute Javascript before parsing the page. 我不认为大多数蜘蛛在解析页面之前实际执行Javascript。 If there's something you really want indexed, it's best to put it on the page as simple content. 如果您真的想要编制索引,最好将其作为简单内容放在页面上。 Bring it in via Ajax, constructing it on the fly via javascript, et. 通过Ajax引入它,通过javascript等动态构建它。 al, certainly will only hinder its SEO value. al,肯定只会阻碍其SEO价值。 Tricky links that take form after being constructed by Javascript are also bad form -- a simple site map probably yields better value. 在由Javascript构造之后形成的棘手链接也是不好的形式 - 简单的站点地图可能产生更好的价值。

As noted in another answer, any content created or modified by JavaScript is unlikely to be 'seen' by the search engines. 如另一个答案所述,任何由JavaScript创建或修改的内容都不太可能被搜索引擎“看到”。 Although this of course applies wherever you place the JS. 虽然这当然适用于放置JS的任何地方。

Depending on the size of your page and the capability of your hosting it could affect indexing. 根据页面大小和托管功能,它可能会影响索引。 If the extra load is sufficient to start slowing your server's response to page requests then the search engines will slow their spidering and, for a large site, may not manage to crawl the entire site on a timely basis. 如果额外负载足以开始减慢服务器对页面请求的响应,那么搜索引擎将减慢其抓取速度,对于大型站点,可能无法及时抓取整个站点。

Search Engine mainly read textual part of the website.But there are many factor that include that effects seo. 搜索引擎主要阅读网站的文本部分。但是有许多因素包括效果seo。 Using table template, and even using inline css make the page load time a little more. 使用表格模板,甚至使用内联css使页面加载时间更多一些。 even if you can check on html validators it marks all inline ccs as error.Slower responsive time for site. 即使您可以检查html验证器,它也会将所有内联ccs标记为error.Slower对站点的响应时间。

javascript increases the site's load time. javascript会增加网站的加载时间。 I believe that is how it may affect your site's rankings. 我相信这可能会影响您网站的排名。 Head over to https://developers.google.com/speed/pagespeed/insights/ and test your URL. 转到https://developers.google.com/speed/pagespeed/insights/并测试您的网址。 Sometimes using javascript on the first view of your website delays the page load as content is displayed only after the script is rendered. 有时在网站的第一个视图上使用javascript会延迟页面加载,因为只有在呈现脚本后才会显示内容。 That may hurt user experience and SEO. 这可能会损害用户体验和SEO。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM