Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Trang này mô tả cách tuỳ chỉnh đoạn trích kết quả cho trang web của riêng bạn. Để hiển thị đoạn thông tin tuỳ chỉnh, bạn phải thêm dữ liệu có cấu trúc vào các trang web.
Công cụ tìm kiếm có thể lập trình giúp người dùng tìm đúng trang bằng cách cho họ xem một đoạn trích. Đây là một mẫu nội dung nhỏ giúp người dùng tìm kiếm hình dung được nội dung trên trang web. Để tìm hiểu thêm về đoạn trích, hãy xem bài đăng trên blog của Trung tâm quản trị viên trang web về cấu trúc của kết quả tìm kiếm. Nếu không thích các đoạn mã chuẩn do thuật toán của Công cụ tìm kiếm có thể lập trình tạo, bạn có thể tự tạo các đoạn mã của riêng mình. Bạn có thể hiển thị thông tin chính (chẳng hạn như hình thu nhỏ, bản tóm tắt, ngày tháng, quyền tác giả, điểm xếp hạng và giá) ngay trong đoạn trích của mình. Việc có thông tin liên quan nhất trong kết quả tìm kiếm sẽ giúp các trang trong trang web của bạn hấp dẫn hơn đối với người dùng.
Các hình ảnh sau đây minh hoạ nhiều cách để bạn điều chỉnh đoạn trích trong kết quả tìm kiếm.
Hình 1: Đoạn trích kết quả kèm điểm xếp hạng, khoảng giá và bài đánh giá.
Hình 2: Đoạn trích kết quả có định dạng, đường liên kết, hình ảnh và thông tin so sánh.
Hình 3: Đoạn trích kết quả bao gồm loại tài liệu, tác giả, số lượt xem trang và nhận xét.
Hình 4: Đoạn mã kết quả được định dạng nhiều định dạng, cung cấp quyền truy cập đa phương tiện và các nút ("THÊM VÀO GIỎ HÀNG").
Khi lập chỉ mục các trang web của bạn, Công cụ tìm kiếm có thể lập trình sẽ nhận dạng và lưu giữ siêu dữ liệu.
Tìm nạp dữ liệu có cấu trúc đó trong kết quả tìm kiếm cho Công cụ tìm kiếm có thể lập trình của bạn.
Máy chủ của Công cụ tìm kiếm có thể lập trình có thể trả về kết quả tìm kiếm cùng với dữ liệu có cấu trúc ở định dạng JSON.
Tạo một lớp bản trình bày để chuyển đổi dữ liệu có cấu trúc thành HTML được định dạng.
Lớp trình bày là một tập hợp mã (chẳng hạn như JavaScript, PHP, Jetpack và ASP) giúp chuyển đổi dữ liệu thô thành một định dạng mà người dùng nhìn thấy. Đối với Công cụ tìm kiếm có thể lập trình, bạn có thể:
Viết lớp bản trình bày tuỳ chỉnh của riêng bạn để chuyển đổi dữ liệu JSON thành HTML hiển thị cho người dùng cuối bằng cách sử dụng lệnh gọi lại của Phần tử tìm kiếm
Trích xuất dữ liệu có cấu trúc được ghi lại chi tiết hơn trong trang Dữ liệu có cấu trúc. Ngoài ra, việc tạo lớp bản trình bày bằng Phần tử tìm kiếm có thể lập trình sẽ được ghi chi tiết hơn trên trang
Phần tử tìm kiếm có thể lập trình.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 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)."]]