ขออนุญาต เพิ่มเติม กรรีที่ท่านต้องแบ่ง sitemap ออกเป็นหลายๆไฟล์นะครับ
1. เริ่มแรก ให้สร้างไฟล์ sitemap index ขึ้นมา
โดยมีโครงสร้างตามนี้
--------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="
http://www.sitemaps.org/schemas/sitemap/0.9 ">
<sitemap>
<loc>
http://www.localhost.com/sitemap1.xml </loc>
<lastmod>2017-08-10T06:20:11+00:00</lastmod>
</sitemap>
<sitemap>
<loc>
http://www.localhost.com/sitemap2.xml </loc>
<lastmod>2017-04-10T06:30:11+00:00</lastmod>
</sitemap>
<sitemap>
<loc>
http://www.localhost.com/sitemap3.xml </loc>
<lastmod>2017-04-10T06:40:11+00:00</lastmod>
</sitemap>
<sitemap>
<loc>
http://www.localhost.com/sitemap4.xml </loc>
<lastmod>2017-07-04T06:50:11+00:00</lastmod>
</sitemap>
<sitemap>
<loc>
http://www.localhost.com/sitemap5.xml </loc>
<lastmod>2017-08-10T06:50:11+00:00</lastmod>
</sitemap>
</sitemapindex>
------------------------------------------------
ข้างบนนั้นคือ sitemapindex ซึ่งคุณสามารถใช้ submit ใน search engine tools ได้ทุกแห่ง เป็นไปตามมาตรฐานที่กำหนดไว้
โดยไม่จำเป็นต้อง submit ไฟล์ sitemap1.xml ไปจนถึง sitemap5.xml ก็ได้ (แต่ควรดูว่า ที่ webmaster tools ต่างๆ อ่านได้ครบทุกไฟล์ไหม
ถ้าไม่ครบ ก็ submit เพิ่ม เฉพาะไฟล์ที่ขาดไปก็ได้
ไฟล์ย่อย จะเพิ่มไปอีก กี่ร้อย กี่พันไฟล์ก็ได้ เช่น เพิ่มไปจนถึง sitemap1000.xml
จุดสำคัญคือ อย่าให้ใหญ่เกินไป จน search engine อ่านไม่หมด
ถ้าใหญ่เกิน 3000-4000 บันทัด ก็ compress ซะเท่านั้นเอง
*************************************************************************************************************
2. ในไฟล์ sitemap1.xml
ก็ทำตามโครงสร้างเดิมที่มีอยู่แล้ว
เวลาที่ generated ออกมา จะเรียงลำดับไฟล์ยังไงก็ได้
แต่อย่าให้มีลิ้งค์ซ้ำในไฟล์อื่นๆ
และเช่นเดิม ถ้าไฟล์เหล่านี้ใหญ่เกินไป ก็ compress
เปลี่ยนชื่อ นามสกุลของไฟล์ให้ตรงกับ sitemapindex ด้วย
*************************************************************************************************************
3. มีลืมอีกจนได้
ที่ไฟล์ robots.txt
เพิ่มข้อความไปอีก 1 บันทัด คือ
Sitemap:
http://www.localhost.com/sitemap.xml โดย sitemap.xml นั่นคือ sitemapindex นะครับ
การเพิ่มบันทัดนี้เข้าไป แม้จะไม่ใช่วิธีที่ถูกยึดถือว่า ใช่
แต่มันก็พอจะช่วยให้บาง search engine เข้าใจได้ว่า คุณมี sitemap และมันอยู่ตรงไหน
****************************************************************************************
หวังว่าจะมีประโยชน์นะครับ