{
"$type": "site.standard.document",
"canonicalUrl": "https://www.simoncox.com/short-articles/2023-07-07-solving-a-date-display-issue-in-11ty-templates/",
"description": "Fixed a date display issue in 11ty templates by applying the toDateString to format update dates properly to comply with Google’s sitemap requirements.",
"path": "/short-articles/2023-07-07-solving-a-date-display-issue-in-11ty-templates/",
"publishedAt": "2023-07-07T14:53:37.842Z",
"site": "at://did:plc:tki7vwlanxbwrz2er67eaeqa/site.standard.publication/3mp4h4md7zv2y",
"tags": "Eleventy",
"textContent": "I have recently changed the lastmod date in my xml site map to be accurate now that Google are wanting that. Part of what Google wanted was for the page to state the update date on it. I pulled this data from the posts front matter but because I had set an 11ty filter for the sitemap the output on the page was the full UTC:\n\nUpdated: 2023-04-03T00:00:00.000\n\nThe resolution was to add .toDateString() to the front matter item, dateUpdated, in the template giving me: \n\ndateUpdated.toDateString()\n\nWhich displays as:\n\nUpdated: Mon Apr 03 2023\n\nFar better!",
"title": "Solving a date display issue in 11ty templates"
}