จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
แก้ไขเนื้อหาที่โหลดแบบ Lazy Loading
การชะลอการโหลดเนื้อหาที่ไม่สำคัญหรือมองไม่เห็น หรือที่เรียกว่า "การโหลดแบบ Lazy Loading" นั้นเป็นการปฏิบัติที่พบได้บ่อยและเป็นแนวทางปฏิบัติแนะนำสำหรับ UX ดูข้อมูลเพิ่มเติมได้ที่แหล่งข้อมูลของ web.dev เกี่ยวกับการทำ Lazy Loading รูปภาพและวิดีโอ
แต่หากใช้เทคนิคนี้อย่างไม่ถูกต้อง การทำ Lazy Loading อาจซ่อนเนื้อหาจาก Google โดยไม่ตั้งใจได้ เอกสารนี้จะอธิบายวิธีตรวจสอบว่า Google รวบรวมข้อมูลและจัดทำดัชนีเนื้อหาแบบ Lazy Loading ได้
โหลดเนื้อหาเมื่อเนื้อหาแสดงในวิวพอร์ต
เพื่อให้ Google เห็นเนื้อหาทั้งหมดในหน้า โปรดตรวจสอบว่าการใช้การโหลดแบบ Lazy Loading นั้นโหลดเนื้อหาที่เกี่ยวข้องทั้งหมดเมื่อมีการแสดงเนื้อหานั้นๆ ในวิวพอร์ต ต่อไปนี้คือวิธีใช้การโหลดแบบเลื่อนลง
วิธีการที่กล่าวถึงไม่ได้อาศัยการดำเนินการของผู้ใช้ เช่น การเลื่อนหรือคลิก เพื่อโหลดเนื้อหา ซึ่งเป็นสิ่งที่สำคัญเนื่องจาก Google Search ไม่ได้โต้ตอบกับหน้าเว็บของคุณ
อย่าใส่การโหลดแบบ Lazy Loading ในเนื้อหาที่มีแนวโน้มที่จะแสดงทันทีเมื่อผู้ใช้เปิดหน้าเว็บ ซึ่งอาจทำให้เนื้อหาใช้เวลาโหลดนานขึ้นและแสดงในเบราว์เซอร์ช้าลง ซึ่งผู้ใช้จะสังเกตเห็นได้อย่างชัดเจน
อย่าลืมทดสอบการใช้งาน
ในระดับสูง การเลื่อนได้ไม่รู้จบเป็นเทคนิคที่โหลดเนื้อหามากขึ้น หน้าเว็บที่หลากหลายมากขึ้น เมื่อผู้ใช้เลื่อนหน้าเว็บที่ยาวลง ซึ่งอาจเป็นบทความยาวๆ 1 ชิ้นที่แบ่งออกเป็นหลายส่วน หรือคอลเล็กชันรายการที่แบ่งออกเป็นหลายส่วนในลักษณะเดียวกัน หากต้องการใช้การเลื่อนได้ไม่รู้จบในลักษณะที่จัดทำดัชนีได้ ให้ตรวจสอบว่าเว็บไซต์รองรับการโหลดที่ใส่เลขหน้าของข้อมูลโค้ดเหล่านี้โดยทําดังนี้
- ตั้งค่า URL ที่ไม่ซ้ำกันแบบถาวรให้กับแต่ละกลุ่ม
- ตรวจสอบว่าเนื้อหาที่แสดงใน URL แต่ละรายการเหมือนกันทุกครั้งที่โหลดในเบราว์เซอร์
วิธีหนึ่งในการทำเช่นนี้คือการใช้หมายเลขหน้าแบบสัมบูรณ์ใน URL เช่น ใช้
?page=12
เป็นพารามิเตอร์การค้นหา
- หลีกเลี่ยงการใช้องค์ประกอบแบบสัมพัทธ์ เช่น
?date=yesterday
ใน URL เหล่านี้
วิธีนี้จะช่วยให้เครื่องมือค้นหาและผู้ใช้พบเนื้อหาเดียวกันภายใต้ URL หนึ่งๆ เสมอ ซึ่งทำให้เครื่องมือค้นหาจัดทำดัชนีเนื้อหาได้อย่างเหมาะสมได้ง่ายขึ้น และช่วยให้ผู้ใช้แชร์และมีส่วนร่วมกับเนื้อหาส่วนนั้นอีกครั้งได้
- ลิงก์ไปยัง URL แต่ละรายการตามลำดับเพื่อให้เครื่องมือค้นหาค้นพบ URL เหล่านั้นในชุดแบบแบ่งหน้า ดูข้อมูลเพิ่มเติมเกี่ยวกับแนวทางปฏิบัติแนะนำเมื่อใช้การใส่เลขหน้า
- เมื่อโหลดข้อมูลส่วนใหม่ของหน้าเว็บเพื่อตอบสนองต่อการเลื่อนของผู้ใช้ และกลายเป็นองค์ประกอบหลักที่ผู้ใช้มองเห็น ให้อัปเดต URL ที่แสดงโดยใช้ History API
ซึ่งช่วยให้ผู้ใช้รีเฟรช แชร์ และลิงก์ไปยัง URL ปัจจุบันที่แสดงในเบราว์เซอร์ได้
ทดสอบ
หลังจากที่ตั้งค่าการนำไปใช้แล้ว ให้ตรวจสอบว่าทุกอย่างทำงานได้ถูกต้อง
คุณสามารถใช้เครื่องมือตรวจสอบ URL ใน Search Console เพื่อดูว่าระบบโหลดเนื้อหาทั้งหมดหรือไม่
ตรวจสอบ HTML ที่แสดงผลเพื่อให้แน่ใจว่าเนื้อหาอยู่ใน HTML ที่แสดงผลโดยค้นหาในเครื่องมือตรวจสอบ URL หาก URL รูปภาพหรือวิดีโอปรากฏในแอตทริบิวต์ src
ในองค์ประกอบ <img>
หรือ <video>
ใน HTML ที่แสดงผล แสดงว่าการตั้งค่าทำงานได้อย่างถูกต้อง
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-04 UTC
[null,null,["อัปเดตล่าสุด 2025-08-04 UTC"],[[["\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 Website Content | Google Search Central\n\nFix lazy-loaded content\n=======================\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----------------------------------------------\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\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\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."]]