改 sitemap.xml 嘅 lastmod:真係改過嘅頁,先寫嗰日
要做嘅嘢:打開 sitemap.xml,將每一頁嘅 lastmod 寫成你上次真正改嗰頁嘅日期。改咗邊頁先改邊條,唔好將成個檔蓋成今日。十五分鐘搞掂。
依據:Google 官方 Build and submit a sitemap。頁面標明最後更新 2026-07-08 UTC。Google 會用 <lastmod>,前提係個日期同頁面真實改動對得上。改正文、結構化數據或者頁面上嘅連結先算;淨係改版權年份唔算。<priority> 同 <changefreq> Google 會忽略。日期跟 sitemaps 協議 嘅 W3C Datetime,寫 YYYY-MM-DD 就得,而且係頁面改咗嘅日子,唔係你產生地圖嗰陣嘅日子。
如果你開到嘅係地圖索引(入面係 <sitemap>,一行一個子檔),要入去子檔先改每一頁嘅 lastmod。索引上嘅 lastmod 只代表個子檔幾時改過。一行一條網址嘅 .txt 地圖寫唔到 lastmod,要用 XML。
貼呢段
今日只改咗服務頁,所以得第一條係今日。關於頁冇郁過,留返上次改佢嗰日。URL 入面有 & 要寫成 &。有確實時間先寫 2026-10-22T15:00:00+08:00。
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://你個域名/services.html</loc>
<lastmod>2026-10-22</lastmod>
</url>
<url>
<loc>https://你個域名/about.html</loc>
<lastmod>2026-08-31</lastmod>
</url>
</urlset>
貼喺邊
- WordPress:唔好手改產生出嚟嘅 XML,亦唔好再上傳一個
sitemap.xml蓋住。入後台改你真係要改嗰頁,撳 Update。核心地圖用嗰頁嘅修改時間寫lastmod。設定 → 閱讀(Settings → Reading)唔好剔「Discourage search engines from indexing this site」,否則核心地圖會停。入口係https://你個域名/wp-sitemap.xml,再開頁面子檔(通常wp-sitemap-posts-page-1.xml)睇你改嗰頁。用 Yoast 嘅:Yoast SEO → Settings → Site features → APIs,XML sitemaps 開住,入口https://你個域名/sitemap_index.xml,入page-sitemap.xml。Yoast 同樣用文章修改時間。唔好裝會每日把全部lastmod改成今日嘅插件。 - Cloudflare:地圖仍然放喺來源站。域名有經 Cloudflare 代理,改完要清呢條 URL 嘅快取,外面先見到新日期。後台 → 你個域名 → Caching → Configuration → Purge Cache → Custom Purge → Purge by 揀 URL → 貼地圖網址 → Purge。核心 WordPress 貼
https://你個域名/wp-sitemap.xml同你改過嘅子檔;自訂 HTML 貼https://你個域名/sitemap.xml。步驟同官方 Purge by single-file 一致,該頁最後更新 2026-09-29。 - 自訂 HTML:上面段存做網站根目錄
sitemap.xml,即https://你個域名/sitemap.xml。已經有檔就只改今次郁過嘅<lastmod>。robots.txt未有Sitemap:嘅話,加一行Sitemap: https://你個域名/sitemap.xml。
點樣驗證
curl -s https://你個域名/sitemap.xml | grep lastmod
你今日改過嘅頁先至係今日;冇改嘅頁唔應該變成今日。WordPress 核心將網址換成子檔,例如 https://你個域名/wp-sitemap-posts-page-1.xml。curl 仍然係舊日期、但你已經改咗來源檔,就按 Cloudflare 嗰步清 URL 再 curl。
香港實例(2026-10-22 查證)
https://www.websitejai.com/sitemap.xml 每頁有自己嘅 lastmod。/organization-json-ld.html 係 2026-10-19,/robots-txt-ai-crawlers.html 係 2026-08-31,同一份檔唔係全部網址同一個日子。檔入面有 priority,Google 會忽略,你對 lastmod 就得。
想我哋幫手套上去。