Hide Blog Post Dates from Google Search Results
Google will pull a lot of information from your website and displays it on the Google Search Results Page, however, some that data you might not want displayed, like the published date. Here are a few methods to get rid of the date.
I recently received a question from Noah:
Do you have any way to hide dates from Google SERPs?…There's tons of plugins for Wordpress on this subject, but nearly nothing for SS outside of the easy way to hide the dates inside of the post itself.
We worked through this together and he reported Method 3 below for him worked well. Jump down to Method 3: Remove the document & blog post data for the code solution. But if you’re interested and not inclined to use code, keep reading.
Where the SERP data comes from?
I hesitated even writing something about this, because of the myriad of methods Google uses to pull data and index websites, it’s truly a black box. But generally speaking, all the data that shows up on the search results page is somewhere on the page itself.
SERP - Search Engine Results Page
This is what you think of as “Google”. When you type in a question and you see all of the results, that is called a SERP, or the Search Engine Results Page.
For the date specifically, I jumped into the web inspector and found 3 different areas in the HTML where Squarespace shows a date.
Document Information: Date Published
Document Information: Date Modified
Blog Post: Date Published
The document information is in the <head> tag within a <meta> element, and we don’t ever see this on the page. The Blog Post: Date Published is what we see on the blog post itself. To change or hide that date, we have to remove or adjust one or all of these three items.
Method 1: Update the Modified Date
This method won’t get rid of the date, but it will update it so that it shows a more recent date.
The article from the image above, was originally published Feb 20th, 2020. However, I updated the article on Feb 23rd, 2022 and now that’s the date appearing in the SERP.
To update the page, I only changed a few things on the page itself — added a sentence here, removed a sentence there. I didn’t update the “Published Date” in the Blog Post Settings, I just updated some of the content.
When you update content on a blog post, without you knowing, Squarespace updates the “Document Information: Date Modified” value, and this is what Google wants to put in the SERP.
The only pages that get a date next to them in the SERP are blog pages, regular pages don’t. For example, here is a regular page on my website, my “articles” page, as viewed on Google.
No date! Dates don’t gets added on regular pages.
So a work-around would be to redirect a blog posts item to a regular page. To do this, create a new blog post item, and set it up as you want it to show in your summary block or blog page, but no need to add the actual blog post body.
In the blog post settings, you can redirect the blog post to a normal page that you’ve built.
Just toggle on the “Link Post Title to Source URL”, and add in the URL to where you want to link out too.
This is obvisouly very onerous if you’re building out a bunch of blog post pages, so it’s not necessarily the best option.
Method 3: Remove the document & blog post data
Addition-all, we can use some javascript to remove the date from all three of the places the date shows up. Add this code to the Site Footer Code
<script>
/**
* Remove Blog Post Dates From SERP
* From Will-Myers.com
**/
function removeDates() {
let metaPublished = document.querySelector('head meta[itemprop="datePublished"]');
if (metaPublished) metaPublished.remove();
let metaModified = document.querySelector('head meta[itemprop="dateModified"]');
if (metaModified) metaModified.remove();
let datePublished = document.querySelector('time.dt-published');
if (datePublished) datePublished.remove();
}
removeDates()
window.addEventListener('DOMContentLoaded', removeDates)
</script>
I’m removing all 3 because that is what worked when testing this out; however, it might be possible with just removing the metaModified & metaPublished values. Feel free to delete lines 9 & 10 above to keep the date published value showing on your blog and let us know if that works!
Once you’ve made these changes, it will take some time for Google to crawl your website again and update the data for your blog posts. It can even take up to a month. You can speed up this process by asking google to crawl your website using the Google Search Console. This is outside of the scope of this tutorial, but there are TONS of resources out there on this subject.
As always, comment below to share with other Squarespace-ers which method worked for you and any other feedback you have.
Related Code Snippets
The below Code Snippets are available to Code Curious members.