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

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

About: SQSP User for 17 yrs. Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF Digital, building Squarespace Extensions to supercharge your commerce website. 
Content: Links in my posts may refer to SF Digital products or may be affiliate links.
If my advice helped, you can thank me by clicking one of the feedback emojis below. I love coffee too.

Link to comment

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

About: SQSP User for 17 yrs. Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF Digital, building Squarespace Extensions to supercharge your commerce website. 
Content: Links in my posts may refer to SF Digital products or may be affiliate links.
If my advice helped, you can thank me by clicking one of the feedback emojis below. I love coffee too.

Link to comment
  • 1 year later...
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.

Link to comment

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.