透過集合功能整理內容 你可以依據偏好儲存及分類內容。
修正延遲載入內容
延緩載入次要或不可見的內容是提升效能和使用者體驗的常見最佳做法,這種做法通常稱為「延遲載入」。詳情請參閱 web.dev 延遲載入圖片和影片的資源。然而,如果未正確執行,這項技術可能會不小心對 Google 隱藏特定內容。這份文件會說明如何確認 Google 可以檢索延遲載入的內容,並為其建立索引。
當可視區域顯示內容時載入內容
為了確保 Google 能夠完整查看網頁內容,請在執行延遲載入時,確認所有相關內容在可視區域顯示時皆已載入。以下列舉幾種導入延遲載入的方法:
上述方法不會依賴使用者動作 (例如捲動或點選) 來載入內容,這點很重要,因為 Google 搜尋不會與網頁互動。
請勿在使用者開啟網頁時,在可能立即顯示的內容中採用延遲載入功能。這可能會導致內容載入和顯示在瀏覽器中所需的時間變長,使用者會明顯察覺到。
此外,請務必測試您的導入作業。
無限捲動技術可讓使用者在捲動長網頁時,載入更多內容和更多不同網頁。這可能是分成多個區塊的長篇文章,或是類似分成多個區塊的一組項目。如要以可編入索引的方式實作無限捲動功能,請確認您的網站支援分頁載入這些區塊,方法如下:
- 為每個區塊提供專屬的永久網址。
- 請確認瀏覽器每次載入每個網址時,顯示的內容都相同。 其中一種做法是在網址中使用絕對頁碼,例如使用
?page=12
做為查詢參數。 - 請避免在這些網址中使用
?date=yesterday
等相對元素。這樣一來,搜尋引擎和使用者都可以在特定網址找到相同內容,讓搜尋引擎更容易正確建立內容索引,並讓使用者分享及重新與該部分內容互動。 - 依序連結至個別網址,讓搜尋引擎能在分頁組合中發現網址。進一步瞭解實作分頁模式的最佳做法。
- 當系統載入新網頁區塊以回應使用者捲動動作,且該區塊成為使用者的主要可見元素時,請使用 History API 更新顯示的網址。這樣一來,使用者就能重新整理、分享及連結至瀏覽器目前顯示的網址。
測試
導入作業設定完畢後,請確保作業能夠正確執行。您可以使用 Search Console 的網址檢查工具確認所有內容是否已載入。請在網址檢查工具中查看轉譯後的 HTML,確認內容是否已轉譯完成。如果圖片或影片網址出現在轉譯後 HTML 中 <img>
或 <video>
元素的 src
屬性中,表示設定正確無誤。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-04 (世界標準時間)。
[null,null,["上次更新時間:2025-08-04 (世界標準時間)。"],[[["\u003cp\u003eEnsure lazy-loaded content is loaded when visible in the viewport, using methods like browser-level lazy-loading or the IntersectionObserver API, so Google can see all content.\u003c/p\u003e\n"],["\u003cp\u003eSupport paginated loading for infinite scroll by giving each content chunk a unique URL, using absolute page numbers, linking sequentially, and updating the URL with the History API.\u003c/p\u003e\n"],["\u003cp\u003eTest your implementation using the URL Inspection Tool in Search Console to verify all content is loaded and appears in the rendered HTML.\u003c/p\u003e\n"]]],["Lazy-loading should load content when visible in the viewport using methods like browser built-in loading, IntersectionObserver API, or JavaScript libraries, avoiding reliance on user actions. For infinite scroll, each content chunk needs a unique, persistent URL (e.g., `?page=12`), and avoid relative elements, also link sequentially to these URL. Update the URL with the History API. Finally, verify implementation with the URL Inspection Tool in Search Console to check if content is present in rendered HTML.\n"],null,["Fix lazy-loaded content\n\n\nDeferring loading of non-critical or non-visible content, also commonly known as \"lazy-loading\", is a common performance and UX best practice. For more information, see [web.dev's resources on lazy-loading images and video](https://web.dev/fast#lazy-load-images-and-video).\nHowever, if not implemented correctly, this technique can inadvertently hide content from Google. This document explains how to make sure Google can crawl and index lazy-loaded content.\n\nLoad content when it's visible in the viewport\n\nTo ensure that Google sees all content on your page, make sure that your lazy-loading implementation loads all relevant content whenever it is visible in the viewport. Here are a few methods to implement lazy-loading:\n\n- [Browser built-in lazy-loading](https://web.dev/articles/browser-level-image-lazy-loading) for images and iframes\n- [IntersectionObserver API](https://web.dev/articles/intersectionobserver) and [a polyfill](https://github.com/GoogleChromeLabs/intersection-observer)\n- A JavaScript library that supports loading data when it enters the viewport\n\nThe methods mentioned don't rely on user actions, such as scrolling or clicking, to load content, which is important as Google Search does not interact with your page.\n\nDon't add lazy-loading to content that is likely to be immediately visible when a user opens a page. That might cause content to take longer to load and show up in the browser, which will be very noticeable to the user.\n\nMake sure to [test your implementation](#test).\n\nSupport paginated loading for infinite scroll\n\n\nAt a high level, infinite scroll is a technique that loads more content, more distinct pages,\nas the user scrolls down a long page. This could be one long article that's split into multiple\nchunks, or a collection of items that's similarly split into chunks. To implement infinite scroll\nin an indexable way, make sure your website supports paginated loading of these chunks by doing\nthe following:\n\n- Give each chunk its own persistent, unique URL.\n- Ensure that the content shown on each URL remains the same every time it's loaded in a browser. One way this can be done is to use absolute page numbers in the URL, for example by using `?page=12` as a query parameter.\n- Avoid using relative elements like `?date=yesterday` in these URLs. This allows search engines and users to consistently find the same content under a given URL, making it easier for search engines to properly index the content, and allowing users to share and reengage with that part of your content.\n- Link sequentially to the individual URLs so that search engines can discover the URLs in a paginated set. Find out more about [best\n practices when implementing pagination](/search/docs/specialty/ecommerce/pagination-and-incremental-page-loading#best-practices-when-implementing-pagination).\n- When a new page chunk is loaded in response to the user scrolling, and it becomes the primary visible element for the user, update the displayed URL using the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API). This allows the user to refresh, share, and link to the current URL displayed in the browser.\n\nTest\n\n\nAfter you set up your implementation, make sure it works correctly.\nYou can use the [URL Inspection Tool](https://support.google.com/webmasters/answer/9012289) in Search Console to see if all content was loaded.\nCheck the rendered HTML to make sure your content is in the rendered HTML by looking for it in URL Inspection Tool. If your image or video URLs appear in the `src` attribute on the `\u003cimg\u003e` or `\u003cvideo\u003e` elements in the rendered HTML, your setup works correctly."]]