การปรับแต่งตัวอย่างของผลลัพธ์
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
หน้านี้จะอธิบายวิธีปรับแต่งตัวอย่างข้อมูลผลการค้นหาสำหรับเว็บไซต์ของคุณเอง หากต้องการแสดงตัวอย่างข้อมูลที่กำหนดเอง คุณต้องเพิ่มข้อมูลที่มีโครงสร้างลงในหน้าเว็บ
- ภาพรวม
- การสร้างข้อมูลโค้ดแบบสมบูรณ์ด้วยองค์ประกอบ Programmable Search
- การสำรวจฟีเจอร์อื่นๆ
ภาพรวม
Programmable Search Engine ช่วยให้ผู้ใช้พบหน้าเว็บที่ถูกต้องด้วยการแสดงตัวอย่างข้อมูล ซึ่งเป็นตัวอย่างเนื้อหาเล็กๆ น้อยๆ ที่ช่วยให้ผู้ใช้ Search ทราบว่าหน้าเว็บนั้นๆ มีอะไรบ้าง หากต้องการดูข้อมูลเพิ่มเติมเกี่ยวกับตัวอย่างข้อมูล โปรดดูบล็อกโพสต์ของศูนย์กลางผู้ดูแลเว็บเกี่ยวกับโครงสร้างของผลการค้นหา หากไม่ชอบข้อมูลโค้ดมาตรฐานที่สร้างโดยอัลกอริทึม Programmable Search Engine คุณสร้างข้อมูลโค้ดของคุณเองได้ คุณจะแสดงข้อมูลสำคัญ เช่น ภาพขนาดย่อ ข้อมูลสรุป วันที่ นักเขียน การให้คะแนน และราคาได้โดยตรงในตัวอย่าง การมีข้อมูลที่เกี่ยวข้องมากที่สุดในผลการค้นหาของคุณจะช่วยให้หน้าเว็บในเว็บไซต์ของคุณดึงดูดความสนใจของผู้ใช้ได้มากขึ้น
ตัวเลขต่อไปนี้สาธิตวิธีการต่างๆ ที่คุณสามารถปรับแต่งตัวอย่างข้อมูลในผลการค้นหาของคุณ
รูปที่ 1: ตัวอย่างข้อมูลของผลลัพธ์ที่มีคะแนน ช่วงราคา และรีวิว

รูปที่ 2: ตัวอย่างข้อมูลของผลการค้นหาพร้อมการจัดรูปแบบ ลิงก์ รูปภาพ และข้อมูลที่เปรียบเทียบ

รูปที่ 3: ตัวอย่างข้อมูลของผลลัพธ์ที่มีประเภทเอกสาร ผู้เขียน การดูหน้าเว็บ และความคิดเห็น

รูปที่ 4: ตัวอย่างข้อมูลผลการค้นหาที่จัดรูปแบบให้ซึ่งให้สิทธิ์เข้าถึงแบบมัลติมีเดียและปุ่ม ("เพิ่มลงในรถเข็น")

กลับไปด้านบน
การสร้างตัวอย่างข้อมูลสื่อสมบูรณ์ด้วยองค์ประกอบ Programmable Search
โดยพื้นฐานแล้ว การสร้างตัวอย่างข้อมูลสื่อสมบูรณ์เกี่ยวข้องกับขั้นตอนต่อไปนี้
- ให้ข้อมูลที่มีโครงสร้างในหน้าเว็บ
เมื่อ Programmable Search Engine จัดทำดัชนีหน้าเว็บของคุณ โปรแกรมจะจดจำและเก็บรักษาข้อมูลเมตาไว้
- ดึงข้อมูลที่มีโครงสร้างนั้นในผลการค้นหาสำหรับ Programmable Search Engine
เซิร์ฟเวอร์ Programmable Search Engine แสดงผลการค้นหาพร้อมข้อมูลที่มีโครงสร้างในรูปแบบ JSON ได้
- สร้างเลเยอร์งานนำเสนอเพื่อเปลี่ยนรูปแบบข้อมูลที่มีโครงสร้างเป็น HTML ที่มีการจัดรูปแบบ
เลเยอร์งานนำเสนอคือชุดโค้ด (เช่น JavaScript, PHP, JSP และ ASP) ที่แปลงข้อมูลดิบให้เป็นรูปแบบที่แสดงให้ผู้ใช้เห็น ในกรณีที่เป็น Programmable Search Engine คุณจะทำสิ่งต่อไปนี้ได้
- ใช้
องค์ประกอบ Programmable Search เพื่อเปลี่ยนรูปแบบเอาต์พุต JSON สำหรับการนำเสนอแก่ผู้ใช้
- เขียนเลเยอร์งานนำเสนอที่กำหนดเองที่แปลงข้อมูล JSON เป็น HTML ที่แสดงต่อผู้ใช้ปลายทางโดยใช้ Callbacks ขององค์ประกอบ Search
การดึงข้อมูลที่มีโครงสร้างจะมีการอธิบายรายละเอียดเพิ่มเติมในหน้าข้อมูลที่มีโครงสร้าง และการสร้างเลเยอร์งานนำเสนอด้วยองค์ประกอบ Programmable Search จะมีการบันทึกไว้อย่างละเอียดในหน้า
องค์ประกอบ Programmable Search
กลับไปด้านบน
การสำรวจฟีเจอร์อื่นๆ
ข้อมูลโค้ดที่กำหนดเองทำงานได้ดีกับฟีเจอร์อื่นๆ ของ Programmable Search Engine ดังนี้
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[[["\u003cp\u003eProgrammable Search Engine allows you to customize result snippets to showcase key information like images, summaries, and ratings, making your site's search results more compelling.\u003c/p\u003e\n"],["\u003cp\u003eTo create custom snippets, you need to add structured data to your webpages, which Programmable Search Engine uses to generate rich snippets.\u003c/p\u003e\n"],["\u003cp\u003eThe Programmable Search Element can be utilized to easily transform the structured data into formatted HTML for display in search results.\u003c/p\u003e\n"],["\u003cp\u003eYou can further enhance your search results by exploring features like Drilling Deeper into Search Results and Providing Structured Data.\u003c/p\u003e\n"]]],[],null,["# Customizing Results Snippets\n\nThis page describes how to customize the result snippets for your own website. To render your customized snippets, you must add structured data to your webpages.\n\n1. [Overview](#overview)\n2. [Creating Rich Snippets with the Programmable Search Element](#creating_snippets)\n3. [Exploring Other Features](#next)\n\nOverview\n--------\n\nProgrammable Search Engine helps users find the right page by showing them a snippet---a small sample of content that gives search users an idea of what's in the webpage. To learn more about snippets, see the Webmaster Central [blog post](http://googlewebmastercentral.blogspot.com/2007/11/anatomy-of-search-result.html) on the anatomy of a search result. If you do not like the standard snippets created by the Programmable Search Engine algorithm, you can create your own snippets. You can showcase key information---such as image thumbnails, summaries, dates, authorship, ratings, and prices---directly in your snippets. Having the most relevant information in your search results makes the webpages in your site more compelling to your users.\n\nThe following figures demonstrate various ways you can customize the snippets in your search results.\n\n**Figure 1:** Result snippet with rating, price range, and review.\n\n**Figure 2:** Result snippet with formatting, links, image, and comparative information.\n\n**Figure 3:** Result snippet that includes document types, authors, page views, and comments.\n\n**Figure 4:** Richly formatted result snippet that provides multimedia access and buttons (\"ADD TO CART\").\n\n[Back to top](#top)\n\nCreating Rich Snippets with the Programmable Search Element\n-----------------------------------------------------------\n\nEssentially, creating rich snippets involves the following steps:\n\n1. Provide [structured data](/custom-search/docs/structured_data) in your webpages.\n\n When Programmable Search Engine is indexing your webpages, it recognizes and preserves\n the metadata.\n2. Fetch that structured data in the search results for your Programmable Search Engine. The Programmable Search Engine server can return the search results, along with the\n structured data in JSON format.\n\n3. Create a presentation layer to transform the structured data into formatted HTML. A presentation layer is a set of code (such as JavaScript, PHP,\n JSP and ASP) that transforms the raw data into a format that is displayed\n to the user. In the case of Programmable Search Engine, you can:\n\n - Use the [Programmable Search Element](/custom-search/docs/element) to transform JSON output for presentation to the user.\n - Write your own custom presentation layer that transforms JSON data to HTML that is presented to the end user using Search Element [Callbacks](/custom-search/docs/element#search-time-callbacks)\n\n\nStructured data extraction is documented in more detail in the\n[Structured Data](/custom-search/docs/structured_data) page, and creating a presentation\nlayer with the Programmable Search Element is documented in more detail at the\n[Programmable Search Element](https://developers.google.com/custom-search/docs/element) page.\n\n[Back to top](#top)\n\nExploring Other Features\n------------------------\n\n\nCustom Snippets works well with several other Programmable Search Engine features:\n\n- If you want to learn more about changing the order of your results, see [Drilling Deeper into Search Results](/custom-search/docs/structured_search).\n- If you want to learn more about what structured data Google supports, see [Providing Structured Data](/custom-search/docs/structured_data).\n- If you want to learn more about the Programmable Search Element, see [Programmable Search Element documentation](https://developers.google.com/custom-search/docs/element)."]]