進一步瞭解網頁
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
2014年5月30日星期五
作者:
Erik Hendriks and Michael Xu, Software Engineers, and
Kazushi Nagayama
, Webmaster Trends Analyst
回首
1998
年,當我們的伺服器在
Susan Wojcicki
的車庫中運作時,我們還不用真的去擔心 JavaScript 或 CSS 的問題。當時,這些技術運用的層面不廣。或者說,JavaScript 的用途就是讓網頁元素可以更炫一點而已。然而,隨著時間過去,很多事情都大不相同。現在,網路上遍佈各種內容豐富、採用動態技術的出色網站,這些網站都大量運用 JavaScript。今天,我們要談談如何轉譯內容更豐富的網站。這代表我們以更接近現代網路瀏覽器的角度看待您的網站內容,包含外部資源、執行 JavaScript 並且使用 CSS。
我們傳統上只注重從 HTTP 回應內文中獲得的原始文字內容,並未確實解讀執行 JavaScript 的典型瀏覽器看到了哪些內容。因此,當這些具備重要內容 (由 JavaScript 轉譯) 的網頁開始出現時,我們無法協助搜尋者找到這些網頁,造成搜尋者與網站管理員雙輸的局面。
為了解決這個問題,我們決定嘗試以執行 JavaScript 的方式來解讀網頁。就目前網路的規模而言,要達成這個目標相當困難,但我們認為這絕對值得一試。我們已經花了好一段時間來逐步改善作業方式。在過去這幾個月中,我們的索引系統已經轉譯了相當大量的網頁,而且在檢視網頁時,角度盡量與一般使用者的瀏覽器 (啟用 JavaScript) 保持一致。
在轉譯作業執行期間,有時結果不盡如人意,這可能會對您網站的搜尋結果產生負面影響。以下說明部分潛在的問題,以及您可如何盡量協助避免問題發生:
-
如果位於獨立檔案中的 JavaScript 或 CSS 等資源遭到封鎖 (例如使用 robots.txt),那麼 Googlebot 就無法擷取這些資源,我們的索引系統也無法以一般使用者的角度檢視您的網站。建議您允許 Googlebot 擷取 JavaScript 和 CSS,以獲得更理想的內容索引效率。這點對行動版網站而言更加重要,因為 CSS 與 JavaScript 等外部資源可協助我們的演算法瞭解網頁已
針對行動裝置進行最佳化處理
。
-
如果您的網路伺服器無法處理大量的資源檢索要求,那麼我們轉譯您網頁的能力也會受到負面影響。如果您想要確保 Google 能夠轉譯您的網頁,請務必使用足以處理資源檢索要求的伺服器。
-
適度讓自己的網站降級 (不要採用過多網頁技術) 也是不錯的做法。如此一來,就算使用者的瀏覽器並未實作相容的 JavaScript,仍然可以順利檢視您的內容。除此之外,停用/關閉 JavaScript 的訪客和當下無法執行 JavaScript 的搜尋引擎也能因此受惠。
-
有時 JavaScript 可能過於複雜或難以解讀,導致我們無法執行。在這種情況下,我們便無法精確而完整地轉譯網頁。
-
部分 JavaScript 會移除網頁內容,而不是新增內容,造成我們無法為內容建立索引。
為了讓偵錯更簡便,我們目前正在開發相關工具,協助網站管理員進一步瞭解 Google 如何轉譯網站。希望不久之後就能在
網站管理員工具
中為您提供這項工具。
如果您有任何問題,歡迎隨時造訪我們的說明論壇。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2014-05-01 (世界標準時間)。
[null,null,["上次更新時間:2014-05-01 (世界標準時間)。"],[[["\u003cp\u003eGoogle's indexing system is now rendering a significant number of web pages with JavaScript enabled to better understand dynamic content.\u003c/p\u003e\n"],["\u003cp\u003eWebmasters should ensure Googlebot can access JavaScript and CSS files to facilitate proper rendering and indexing, particularly for mobile websites.\u003c/p\u003e\n"],["\u003cp\u003eWebsites should be designed to degrade gracefully for users and search engines that may not have JavaScript capabilities, ensuring content accessibility.\u003c/p\u003e\n"],["\u003cp\u003ePotential issues with rendering may include server overload due to crawl requests, overly complex JavaScript, and JavaScript removing content, which webmasters should address.\u003c/p\u003e\n"],["\u003cp\u003eGoogle is developing a tool in Webmaster Tools to aid webmasters in understanding how Google renders their websites.\u003c/p\u003e\n"]]],["Google's indexing system now renders web pages more like a typical browser, including executing JavaScript and applying CSS. Key actions include allowing Googlebot to retrieve JavaScript and CSS resources, ensuring servers can handle crawl requests, and having sites degrade gracefully. Complex or content-removing JavaScript can hinder indexing. A tool is in development to help webmasters understand how their site is rendered, and the team recommends checking the help forum.\n"],null,["# Understanding web pages better\n\nFriday, May 23, 2014\n\n\nIn [1998](https://www.google.com/about/company/history/) when our\nservers were running in\n[Susan Wojcicki](https://twitter.com/SusanWojcicki)'s garage, we\ndidn't really have to worry about JavaScript or CSS. They weren't used much, or, JavaScript was\nused to make page elements... blink! A lot has changed since then. The web is full of rich,\ndynamic, amazing websites that make heavy use of JavaScript. Today, we'll talk about our\ncapability to render richer websites---meaning we see your content more like modern Web\nbrowsers, include the external resources, execute JavaScript and apply CSS.\n\n\nTraditionally, we were only looking at the raw textual content that we'd get in the HTTP response\nbody and didn't really interpret what a typical browser running JavaScript would see. When pages\nthat have valuable content rendered by JavaScript started showing up, we weren't able to let\nsearchers know about it, which is a sad outcome for both searchers and webmasters.\n\n\nIn order to solve this problem, we decided to try to understand pages by executing JavaScript.\nIt's hard to do that at the scale of the current web, but we decided that it's worth it. We have\nbeen gradually improving how we do this for some time. In the past few months, our indexing system\nhas been rendering a substantial number of web pages more like an average user's browser with\nJavaScript turned on.\n\n\nSometimes things don't go perfectly during rendering, which may negatively impact search results\nfor your site. Here are a few potential issues, and---where possible,---how you can help\nprevent them from occurring:\n\n- If resources like JavaScript or CSS in separate files are blocked (say, with robots.txt) so that Googlebot can't retrieve them, our indexing systems won't be able to see your site like an average user. We recommend allowing Googlebot to retrieve JavaScript and CSS so that your content can be indexed better. This is especially important for mobile websites, where external resources like CSS and JavaScript help our algorithms understand that the pages are [optimized for mobile](/search/docs/crawling-indexing/mobile/mobile-sites-mobile-first-indexing#crawling_requirement).\n- If your web server is unable to handle the volume of crawl requests for resources, it may have a negative impact on our capability to render your pages. If you'd like to ensure that your pages can be rendered by Google, make sure your servers are able to handle crawl requests for resources.\n- It's always a good idea to have your site degrade gracefully. This will help users enjoy your content even if their browser doesn't have compatible JavaScript implementations. It will also help visitors with JavaScript disabled or off, as well as search engines that can't execute JavaScript yet.\n- Sometimes the JavaScript may be too complex or arcane for us to execute, in which case we can't render the page fully and accurately.\n- Some JavaScript removes content from the page rather than adding, which prevents us from indexing the content.\n\n\nTo make things easier to debug, we're currently working on a tool for helping webmasters better\nunderstand how Google renders their site. We look forward to making it to available for you in the\ncoming days in\n[Webmaster Tools](https://search.google.com/search-console).\n\nIf you have any questions, please you can visit our help forum.\n\n\nPosted by Erik Hendriks and [Michael Xu](https://www.linkedin.com/in/michaelxu1999/), Software Engineers, and\n[Kazushi Nagayama](https://plus.google.com/+KazushiNagayama/?rel=author),\nWebmaster Trends Analyst"]]