自定义结果摘要
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本页介绍了如何为您自己的网站自定义搜索结果摘要。要呈现自定义摘要,您必须向网页添加结构化数据。
- 概览
- 使用可编程搜索元素创建富媒体搜索结果
- 探索其他功能
概览
可编程搜索引擎通过向用户显示一个摘要(方便搜索用户了解网页中的内容)而帮助用户找到相应的网页。要详细了解摘要,请参阅有关搜索结果剖析的网站站长中心博文。如果您不喜欢由可编程搜索引擎算法创建的标准摘要,可以自行创建摘要。您可以直接在摘要中展示图片缩略图、摘要、日期、作者信息、评分和价格等关键信息。在搜索结果中包含最相关的信息可使您网站中的网页对用户更有吸引力。
下图显示了您可以自定义搜索结果中摘要的各种方法。
图 1:包含评分、价格范围和评价的结果摘要。

图 2:包含格式、链接、图片和比较信息的结果片段。

图 3:包含文档类型、作者、网页浏览量和评论的结果代码段。

图 4:格式丰富的搜索结果摘要,提供多媒体访问和按钮(“添加到购物车”)。

返回页首
使用可编程搜索元素创建富媒体搜索结果
从本质上讲,创建结构化摘要涉及以下步骤:
- 在您的网页中提供结构化数据。
当可编程搜索引擎将您的网页编入索引时,它会识别并保留这些元数据。
- 在您的可编程搜索引擎的搜索结果中提取这些结构化数据。
可编程搜索引擎服务器可以返回搜索结果以及 JSON 格式的结构化数据。
- 创建表示层,将结构化数据转换为格式化的 HTML。
呈现层是一组代码(例如 JavaScript、PHP、JSP 和 ASP),可将原始数据转换为向用户显示的格式。对于可编程搜索引擎,您可以:
- 使用
可编程搜索元素转换 JSON 输出,以将其呈现给用户。
- 编写您自己的自定义表示层,将 JSON 数据转换为使用搜索元素回调呈现给最终用户的 HTML。
如需详细了解结构化数据提取,请参阅结构化数据页面;如需使用可编程搜索元素创建表示层,请参阅
Programmable Search Element 页面。
返回页首
探索其他功能
自定义摘要可以很好地与多项其他可编程搜索引擎功能配合使用:
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\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)."]]