Skip to content

crawl/sitemap-lastmod-drift and -churn read a bare-year or year-month lastmod as one exact day #758

Closed

Description

@nc9

Once #687 lands, a sitemap with bare-year lastmods (<lastmod>2024</lastmod>) is read instead of failing as a parse error. The W3C Datetime format allows YYYY and YYYY-MM, which name a year or a month, not a day. The lastmod rules read them as the first instant of that period:

  • crawl/sitemap-lastmod-drift (packages/rules/src/crawl/sitemap-lastmod-drift.ts) parses 2024 as 2024-01-01 00:00 UTC and warns that the sitemap lags for nearly every page dated later that year, for example lastmod 2024 vs dateModified 2024-09-10 (253 day(s)).
  • crawl/sitemap-lastmod-churn (packages/rules/src/crawl/sitemap-lastmod-churn.ts) reports the date 2024-01-01, which the sitemap never wrote.

YYYY-MM lastmods already behave this way on main. A site that #687 unblocks goes from one crawl/sitemap-valid error to drift warnings on most of its pages.

Acceptance Criteria

  • crawl/sitemap-lastmod-drift treats a YYYY or YYYY-MM lastmod as the whole year or month: a page dateModified inside that period is not drift, and drift outside it is measured from the nearer end of the period.
  • crawl/sitemap-lastmod-churn never reports a day the sitemap did not write for a YYYY or YYYY-MM lastmod (it reports the period as written, or leaves such entries out).
  • Rule tests cover 2024, 2024-09 and a full datetime for both rules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3bugrulessize: S

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions