Jump to content

Squarespace 7.1: Change blog post dates to show age - "3 days ago" and so on

Go to solution Solved by paul2009,

Recommended Posts

  • Solution
Posted (edited)

There isn't a built-in feature that does this. If you are familiar with JavaScript (or you hire a developer who is) then a solution could be written to do this in JavaScript (assuming the site is on a Business Plan or above).

In summary, you'll first need to use JS to extract the date of each post and calculate the number of seconds between then and now. If it is less than 60 seconds you'd substitute "X seconds ago", if it is less than 3600 you substitute "X minutes ago" and so on.

The script should be added to the Code Injection Footer so that it runs after the blog post(s) have loaded, allowing the dates to be modified.

Edited by paul2009

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.

Posted

The code would be written to look for every blog post date on the page and modify it as described. 

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.

  • 1 year later...
Posted
3 hours ago, hercegovka said:

What is the CSS code to convert dates to show age - like "3 days ago?"

CSS can not be used to convert text. You would need JavaScript. I am unaware of any code that does this.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.