angularJS web應用SEO

世有因果知因求果發表於2015-09-12

javascript給網站帶來豐富的使用者體驗,越來越多的網站開始應用angularjs/emberjs這類MVC來開發web應用,可以說能夠使用native方式來看法的手機app基本都可以使用替代的js框架來開發,這給web開發及web使用者帶來了前所未有的便利。但是不幸的是,到目前為止,主流的搜尋引擎對於javascript的動態內容幾乎無法讀取,因此你的網站本身內容再豐富,對使用者再友好,在google,baidu那裡也是一無所知。這,相信對於網站的owner來講都是一個巨大的問題,誰也不希望自己的網站在搜尋引擎那裡得不到檢索。如何解決這個問題呢?

有一個簡單的思路是:googlebot會抓取網頁的<noscript>google要看的內容</noscript>,這樣我們通過phanmjs這樣的headless browser動態serve googlebot以<noscript>所包含的內容是一個workaround。但是在這裡要注意google的相關政策:

cloaking refers to the practice of presenting different content of URLs to users and search engines.Serving up different results based on user-agent may cause your site to be perceived as deceptive and removed from googl index

總的來說,你需要給到google和使用者基本相同的內容。比如如果使用者js功能關閉,那麼它也應該看到和googlebot相同的內容。

一些隱身的具體例子:

給google一個html靜態檔案,而給使用者展示一個image或者flash;

給google和給使用者以不同的內容;

當你的網站包含一些無法被google crawlable的內容(比如除了flash,js,image外的富媒體),你不能給google以隱藏的內容。因為你應該考慮到那些真正訪問你的網站的使用者也是無法看到這些內容的。

google的建議是:對那些關閉image功能的使用者提供alt text描述image資訊,在noscript tag中提供js的文字替代內容(注意:核心的要求就是你對使用者及google一視同仁,內容基本一樣~!)

ensure that you provide the same content in both elements(for instance, provide the same text in js in the noscript tag)

如果你的網站持續不斷地執行:noscript和js部分內容不一致,google將會採取行動。

當googlebot檢索一個包含js的網頁時,它會index那個網頁,但是它並不會follow或者index任何在js中所隱含的連結。使用js本身是合法的web實踐。然而,使用js故意欺騙js是不被允許的。例如,placing in different text in js than in a noscript tag violates our webmaster guidelines because it displays different content for users(who see the jsbased text)than for google(which see the noscript-based text)。

Along those lines, it violates the webmaster guidelines to embed a link in js that redirects the user to a different page with the intent to show the user a different page than the search engine sees. When a redirect link is embedded in js, the search engine indexes the original page rather than following the link, whereas users are taken to the redirect target. Like cloaking, this practice is deceptive because it displays different content to users and to googlebot, and can take a visitor somewhere other than where they intended to go.

Note that placement of links within jasvascript is alone not deceptive. When examining js on your site to ensure your site adheres to google guidelines, consider the intent:

Keep in mind that since search engines generally can't access the contents of JavaScript, legitimate links within JavaScript will likely be inaccessible to them (as well as to visitors without Javascript-enabled browsers). You might instead keep links outside of JavaScript or replicate them in a noscript tag. Doorway pages

Doorway pages are typically large sets of poor-quality pages where each page is optimized for a specific keyword or phrase. In many cases, doorway pages are written to rank for a particular phrase and then funnel users to a single destination.

Whether deployed across many domains or established within one domain, doorway pages tend to frustrate users, and are in violation of our Webmaster Guidelines.

Google's aim is to give our users the most valuable and relevant search results. Therefore, we frown on practices that are designed to manipulate search engines and deceive users by directing them to sites other than the ones they selected, and that provide content solely for the benefit of search engines. Google may take action on doorway sites and other sites making use of these deceptive practice, including removing these sites from the Google index.

If your site has been removed from our search results, review our Webmaster Guidelines for more information. Once you've made your changes and are confident that your site no longer violates our guidelines, submit your site for reconsideration.

  • 最好不要使用display: none來隱藏一個h1標籤,你可以使用text-indent: -9999px這種模式來隱藏,否則可能會受到處罰;
  • 另外一種方法是預設都是顯示的,document.ready()起來後,js直接把需要預設不顯示的內容給設定對應css類,這個可能是解決SEO的最佳方案了。

 

相關文章