Skip to content

Inconsistent date formats in sitemap is non parsable by google #2335

Open
@0xcrypto

Description

@0xcrypto

Bug Report

Zola depends on user to provide correct date format for the <lastmod> in sitemap which can result in inconsistent date formats. If there are different date formats for lastmod in sitemap.xml, google search console won't accept the sitemap.
image
While a user can use correct date format manually to fix it, it gets cumbersome when there are many writers and posts.

Environment

Zola version:
0.17.1 (Github pages) and zola 0.17.2 (local dev)

Expected Behavior

Sitemap should use same date format irrespective of what user has provided.

Current Behavior

Zola is accepting the frontmatter variable date as provided by the user. I usually mention a date with time ie. 2023-08-20 14:36:26 but sometimes, I use 2023-08-20 only. This is resulting in two different date formats in the sitemap. An excerpt from my current sitemap:

<url>
<loc>
https://eval.blog/research/laravel-deserialization-gadget-chain/
</loc>
<lastmod>2021-06-12</lastmod>
</url>
<url>
<loc>
https://eval.blog/research/microsoft-account-token-leaks-in-harvest/
</loc>
<lastmod>2023-10-21T22:33:40</lastmod>
</url>

Step to reproduce

  • Publish two posts having date in frontmatter. One with date and time format (YYYY-MM-DD HH:mm:ss), second with date only (YYYY-MM-DD)
  • Check date format in <lastmod> tag of the sitemap (http://127.0.0.1:1111/sitemap.xml)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions