Google|Sitemap|Structured Data

Last updated date - how to display it on your blog and keep Google happy

Showcasing your last modified date on your website, sitemap and Article structured data in order to keep your readers and Google updated

Last updated on

|
--- views

Published date vs Last updated date

Articles have two main dates associated with them:

  • Published date - when the article was originally published
  • Last updated date - when the article was last modified

From a user's point of view, these dates might be important when seeing how relevant the article is. The reader might be less inclined to read and take advice from an article published 10 years ago. However, if the content has been refreshed last year (even though published 10 years ago), this adds more credibility to the end user.

However, it's important to not be misleading to the user, as this might impact your SEO in a negative way.

Add Last Updated information to your content page

You can use the new HTML5 time element in order to display the time.

The element takes a datetime attribute which can recognise dates in several formats:

  • date: YYYY-MM-DD
  • datetime with timezone: YYYY-MM-DDThh:mm:ss.Z
  • datetime without timezone: YYYY-MM-DDThh:mm:ss
  • time: hh:mm:ss
  • month: YYYY-MM

Even though adding a time element tag doesn't improve the user experience in any way, it can help Google keep track of the content's freshness.

This is the code that I use to display the last updated/modified date on these articles. The code is written in React so you might need to update it if your language is different.

const formatDate = (date) => {
  const dateObj = new Date(date);
  return dateObj?.toLocaleString("en-US", {
    day: "numeric",
    month: "short",
    year: "numeric",
  });
};

const formattedDate = formatDate(frontMatter.dateModified);

return(
  <p className="mt-3 text-sm text-gray-500">
    Last updated on{" "}
    {/* dateModified = "2022-02-15" */}
    <time
      dateTime={frontMatter.dateModified}
      className="font-bold text-gray-800"
    >
      {formattedDate}
    </time>{" "}
  </p>
)

Sitemap's lastmod

Google recommends to add a <lastmod> to your sitemap in order for Google to recrawl it when there has been a change. If you are using a CMS, you can use the last modification date generated by your CMS, in order to tell Google even if there has been a small change.

In general, the format of the date inside <lastmod> should be YYYY-MM-DD, YYYY-MM-DDThh:mm:ss.Z or YYYY-MM-DDThh:mm:ss

This is an example from my own sitemap:

<url>
  <loc>https://www.seocomponent.com/blog/last-updated-date/</loc>
  <lastmod>2022-02-15</lastmod>
</url>

Update your Article structured data

You can add dateModified and datePublished to your Article structured data

<JsonLd>
  {{
    "@context": "https://schema.org",
    "@type": "Article",
    dateModified: dateModified || datePublished,
    datePublished: datePublished,
    ...
  }}
</JsonLd>

Note that Google recommends to only update the dateModified in your Article schema if you have significant changes to your content. If you have changed a comma, but update the modified date, that might be misleading to the end user.

So if you run a website with a CMS, you might consider having a manual dateModified field which the content person keeps up to date.

However, John follows up with that it wouldn't really have an impact if you made small changes to individual pages and still update the dateModified inside the Article structured data.


All of these things are covered in our dashboard (for multiple languages/frameworks) so feel free to check it out.

All the technical SEO you'd need within our dashboard - just for

SEO component, structured data, favicon setup, sitemap setup and much more in your framework and language.

Learn more

Lifetime access for (early bird price)

A gif showcasing SEO component's dashboard