# 图片站点地图

您可以向现有站点地图添加图片，或为您的图片创建单独的站点地图。向站点地图添加图片有助于 Google 发现我们可能无法通过其他方式找到的图片（例如，您的网站通过 JavaScript 代码链接的图片）。

### 最佳做法

* 遵循[发布图片的最佳做法](https://support.google.com/webmasters/answer/114016)和[网站站长指南](https://support.google.com/webmasters/answer/35769)。
* 您可以[添加图片元数据](https://support.google.com/webmasters/answer/9150868)，例如联系信息和许可信息，这些信息将显示在图片搜索结果中。

### 站点地图示例

以下所示是网页 `http://example.com/sample.html` 的站点地图条目，该网页包含两张图片。

```
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
  <url>
    <loc>http://example.com/sample.html</loc>
    <image:image>
      <image:loc>http://example.com/image.jpg</image:loc>
    </image:image>
    <image:image>
      <image:loc>http://example.com/photo.jpg</image:loc>
    </image:image>
  </url> 
</urlset> 
```

使用上述示例中介绍的语法，您最多可以为每个网页列出 1000 张图片！

### 图片站点地图引用

#### XML 命名空间

图片标记在以下命名空间中定义：

```
image:xmlns="http://www.google.com/schemas/sitemap-image/1.1"
```

#### 图片标记定义

以下站点地图标记专门适用于图片。您必须使用必需的标记；我们建议您使用可选标记提供更多信息和更好的用户体验。

| 标记                     | 是否必需 | 说明                                                                                                                                                                                                                                                               |
| ---------------------- | ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `<image:image>`        | 是    | 包含单张图片的所有相关信息。每个 `<url>` 标记最多可包含 1000   `<image:image>` 标记。                                                                                                                                                                                                      |
| `<image:loc>`          | 是    | <p>图片的网址。</p><p>在某些情况下，图片网址可能与您的主网站不在同一个网域中。即便如此也不必担心，只要这两个网域在 Search Console 中都已验证即可。例如，当您使用内容传送网络（如 Google 协作平台）托管图片时，请确保在 Search Console 中验证相应托管网站。此外，您应确保 <a href="https://support.google.com/webmasters/answer/75712">robots.txt</a> 文件允许抓取想要编入索引的所有内容。</p> |
| `<image:caption>`      | 可选   | 图片的说明文字。                                                                                                                                                                                                                                                         |
| `<image:geo_location>` | 可选   | 图片的地理位置。例如 `<image:geo_location>Limerick, Ireland</image:geo_location>`。                                                                                                                                                                                         |
| `<image:title>`        | 可选   | 图片的标题。                                                                                                                                                                                                                                                           |
| `<image:license>`      | 可选   | 指向图片许可的网址。如果需要，您可以[改用图片元数据](https://support.google.com/webmasters/answer/9150868)。                                                                                                                                                                               |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://blog.jasonzhang.cc/google-dev/search-console-bang-zhu/zhuan-men-mian-xiang-nei-rong-de-zhi-nan/tu-pian-he-shi-pin/tu-pian-zhan-dian-di-tu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
