จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
วิธีรวมส่วนขยาย Sitemap
ส่วนขยาย Sitemap เป็นวิธีที่ดีในการบอกให้ Google ทราบเกี่ยวกับเนื้อหาประเภทต่างๆ และข้อมูลเมตาที่คุณใช้ในเว็บไซต์ บ่อยครั้งเนื้อหาในหน้าเว็บอาจอยู่ในส่วนขยายหลายประเภท เช่น คุณอาจเผยแพร่บทความข่าวที่ฝังรูปภาพและวิดีโอ นอกจากนี้ หน้าเว็บอาจมีเวอร์ชันแปลด้วย ซึ่งหมายความว่าคุณอาจเพิ่มคําอธิบายประกอบ hreflang
สําหรับหน้าเว็บที่แปลแล้วได้
เนมสเปซ
สําหรับส่วนขยาย Sitemap แต่ละรายการที่ต้องการใช้ใน Sitemap คุณจะต้องระบุเนมสเปซที่เกี่ยวข้องซึ่งประกาศแท็กที่ส่วนขยายรองรับ ซึ่งทำได้ด้วยแอตทริบิวต์ xmlns
ของแท็ก urlset
เนมสเปซของส่วนขยาย Sitemap ที่ Google รองรับมีดังนี้
การประกาศเนมสเปซหลายรายการ
หากต้องการประกาศเนมสเปซหลายรายการ ให้เพิ่มการอ้างอิงเนมสเปซที่เกี่ยวข้องลงใน 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>
<!-- 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 อย่างมาก
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-04 UTC
[null,null,["อัปเดตล่าสุด 2025-08-04 UTC"],[[["\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."]]