透過集合功能整理內容
你可以依據偏好儲存及分類內容。
如何合併 Sitemap 擴充元素
Sitemap 擴充元素是讓 Google 瞭解您網站的各種內容及其中繼資料的好方法。網頁內容經常會搭配多種擴充元素;例如,您可能會發布嵌入圖片和影片的新聞報導。此外,您的網頁可能也會經過本地化,這表示您可以為本地化網頁加入 hreflang
註解。
命名空間
針對您想在 Sitemap 中使用的每個 Sitemap 擴充元素,您必須指定會宣告擴充功能支援標記的個別命名空間。您可以藉由使用 urlset
標記的 xmlns
屬性來完成這項作業。Google 支援的 Sitemap 擴充元素命名空間為:
宣告多個命名空間
如要宣告多個命名空間,請按照個別擴充元素的說明文件所述,在 Sitemap 中新增個別的命名空間參照。以下示範如何在 Sitemap 中新增新聞、影片和 xhtml (hreflang
) 擴充元素:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<!-- rest of the sitemap -->
合併 Sitemap 擴充元素
宣告命名空間後,請依照您要使用的 Sitemap 擴充元素說明文件中的詳細實作資訊操作。
如要合併擴充元素,請將所用 Sitemap 擴充元素中的標記逐一新增到適當的 <url>
標記中,方式按照個別 Sitemap 擴充元素的說明文件所述。
舉例來說,如要將新聞、影片和 xhtml (hreflang
) 擴充元素新增至 Sitemap:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://www.example.com/english/page.html</loc>
<!-- Starting with the news extension tags -->
<news:news>
<news:publication>
<news:name>The Example Times</news:name>
<news:language>en</news:language>
</news:publication>
<news:publication_date>2008-12-23</news:publication_date>
<news:title>Companies A, B in Merger Talks</news:title>
</news:news>
<!-- Next we add video extension tags -->
<video:video>
<video:thumbnail_loc>https://www.example.com/thumbs/123.jpg</video:thumbnail_loc>
<video:title>Lizzi is painting the wall</video:title>
<video:description>
Gary is watching the paint dry on the wall Lizzi painted.
</video:description>
<video:player_loc>
https://player.example.com/video/987654321
</video:player_loc>
</video:video>
<!-- And finally the xhtml tags for hreflang -->
<xhtml:link
rel="alternate"
hreflang="de"
href="https://www.example.de/deutsch/page.html"/>
<xhtml:link
rel="alternate"
hreflang="de-ch"
href="https://www.example.de/schweiz-deutsch/page.html"/>
<xhtml:link
rel="alternate"
hreflang="en"
href="https://www.example.com/english/page.html"/>
</url>
<!-- Add more <url> tags -->
Sitemap 中的擴充元素順序在 <loc>
標記之後並不相關。提醒您,請遵守一般 Sitemap 最佳做法,尤其是檔案大小限制。合併 Sitemap 擴充元素會大幅增加 Sitemap 的檔案大小。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-04 (世界標準時間)。
[null,null,["上次更新時間:2025-08-04 (世界標準時間)。"],[[["\u003cp\u003eSitemap extensions inform Google about diverse content types and metadata on your site, such as images, videos, news, and localized versions.\u003c/p\u003e\n"],["\u003cp\u003eTo use sitemap extensions, declare their respective namespaces within the \u003ccode\u003eurlset\u003c/code\u003e tag of your sitemap file.\u003c/p\u003e\n"],["\u003cp\u003eCombine extensions by adding tags from different extensions within the \u003ccode\u003e<url>\u003c/code\u003e tag, following each extension's documentation.\u003c/p\u003e\n"],["\u003cp\u003eThe order of extension tags within the \u003ccode\u003e<url>\u003c/code\u003e tag (after the \u003ccode\u003e<loc>\u003c/code\u003e tag) does not matter.\u003c/p\u003e\n"],["\u003cp\u003eBe mindful of sitemap file size limits, as combining extensions can significantly increase file size.\u003c/p\u003e\n"]]],["Sitemap extensions allow specifying content types and metadata. To combine extensions, declare each extension's namespace using the `xmlns` attribute within the `\u003curlset\u003e` tag, referencing the correct URLs for image, news, video, or `xhtml` (for `hreflang`). After declaring namespaces, insert the tags from each desired extension, following the specifications in the respective documentation, within the `\u003curl\u003e` tag. Extensions can be added in any order after the `\u003cloc\u003e` tag, and combining extensions will increase the overall sitemap file size.\n"],null,["# How to Combine Sitemap Extensions | Google Search Central\n\nHow to combine sitemap extensions\n=================================\n\n\nSitemap extensions are a great way to tell Google about the different kinds of content and\ntheir metadata that you're using on your site. Often the content on your pages may fit into\nmultiple kinds of extensions; for example, you might be publishing news articles that embed\nimages and videos. Additionally, your pages may be localized as well, which might mean that\nyou could add `hreflang` annotations for your localized pages.\n\nNamespaces\n----------\n\n\nFor each sitemap extension that you want to use in a sitemap you need to specify the\nrespective namespace that declares the tags the extension supports. This is done with the\n`xmlns` attribute of the `urlset` tag. The namespaces for the sitemap\nextensions Google supports are:\n\n| Extension tags and their namespace definitions ||\n|---------------------------|------------------------------------------------------------------------------------------------------|\n| `image:` | [`http://www.google.com/schemas/sitemap-image/1.1`](http://www.google.com/schemas/sitemap-image/1.1) |\n| `news:` | [`http://www.google.com/schemas/sitemap-news/0.9`](http://www.google.com/schemas/sitemap-news/0.9) |\n| `video:` | [`http://www.google.com/schemas/sitemap-video/1.1`](http://www.google.com/schemas/sitemap-video/1.1) |\n| `xhtml:` (for `hreflang`) | [`http://www.w3.org/1999/xhtml`](http://www.w3.org/1999/xhtml) |\n\n### Declaring multiple namespaces\n\n\nTo declare multiple namespaces, add the respective namespace references to your sitemap as\ndescribed in the documentation of the respective extensions. Here's an example that shows how\nto add the news, video, and xhtml (for `hreflang`) extensions to a sitemap: \n\n```text\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003curlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\n xmlns:news=\"http://www.google.com/schemas/sitemap-news/0.9\"\n xmlns:video=\"http://www.google.com/schemas/sitemap-video/1.1\"\n xmlns:xhtml=\"http://www.w3.org/1999/xhtml\"\u003e\n \u003curl\u003e\n\u003c!-- rest of the sitemap --\u003e\n```\n\nCombining sitemap extensions\n----------------------------\n\n\nOnce you declared the namespaces, follow the implementation details from the respective sitemap\nextension documentation you're going to use.\n\n- [Image sitemap](/search/docs/crawling-indexing/sitemaps/image-sitemaps)\n- [News sitemap](/search/docs/crawling-indexing/sitemaps/news-sitemap)\n- [Video sitemap](/search/docs/crawling-indexing/sitemaps/video-sitemaps)\n- [`hreflang`](/search/docs/specialty/international/localized-versions#sitemap)\n\n\nTo combine extensions, add the tags from whatever sitemap extensions you're using, one after the\nother, to the appropriate `\u003curl\u003e` tag, as described in each sitemap extension's\ndocumentation.\n\n\nFor example, to add news, video, and xhtml (`hreflang`) extensions to a sitemap: \n\n```scdoc\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003curlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\n xmlns:news=\"http://www.google.com/schemas/sitemap-news/0.9\"\n xmlns:video=\"http://www.google.com/schemas/sitemap-video/1.1\"\n xmlns:xhtml=\"http://www.w3.org/1999/xhtml\"\u003e\n \u003curl\u003e\n \u003cloc\u003ehttps://www.example.com/english/page.html\u003c/loc\u003e\n \u003c!-- Starting with the news extension tags --\u003e\n \u003cnews:news\u003e\n \u003cnews:publication\u003e\n \u003cnews:name\u003eThe Example Times\u003c/news:name\u003e\n \u003cnews:language\u003een\u003c/news:language\u003e\n \u003c/news:publication\u003e\n \u003cnews:publication_date\u003e2008-12-23\u003c/news:publication_date\u003e\n \u003cnews:title\u003eCompanies A, B in Merger Talks\u003c/news:title\u003e\n \u003c/news:news\u003e\n \u003c!-- Next we add video extension tags --\u003e\n \u003cvideo:video\u003e\n \u003cvideo:thumbnail_loc\u003ehttps://www.example.com/thumbs/123.jpg\u003c/video:thumbnail_loc\u003e\n \u003cvideo:title\u003eLizzi is painting the wall\u003c/video:title\u003e\n \u003cvideo:description\u003e\n Gary is watching the paint dry on the wall Lizzi painted.\n \u003c/video:description\u003e\n \u003cvideo:player_loc\u003e\n https://player.example.com/video/987654321\n \u003c/video:player_loc\u003e\n \u003c/video:video\u003e\n \u003c!-- And finally the xhtml tags for hreflang --\u003e\n \u003cxhtml:link\n rel=\"alternate\"\n hreflang=\"de\"\n href=\"https://www.example.de/deutsch/page.html\"/\u003e\n \u003cxhtml:link\n rel=\"alternate\"\n hreflang=\"de-ch\"\n href=\"https://www.example.de/schweiz-deutsch/page.html\"/\u003e\n \u003cxhtml:link\n rel=\"alternate\"\n hreflang=\"en\"\n href=\"https://www.example.com/english/page.html\"/\u003e\n \u003c/url\u003e\n\u003c!-- Add more \u003curl\u003e tags --\u003e\n```\n\n\nThe order of the extension in the sitemap is irrelevant after the `\u003cloc\u003e`\ntag. Keep in mind the\n[general sitemap best practices](/search/docs/crawling-indexing/sitemaps/build-sitemap#general-guidelines),\nespecially the file size limits. Combining sitemap extensions increases the file size of your\nsitemap significantly."]]