hboss22 Posted March 7, 2021 Share Posted March 7, 2021 Hi @paul2009 Im looking to see if the dates for my blog posts throughout the site (in summary blocks, blog pages and individual blog posts) can read "1 day ago" or "5 days ago" or "1 month ago" instead of showing the actual date of the post. Is this possible? Website: http://www.fromyourmuse.com Password: musings2 Beyondspace 1 Link to comment
Solution paul2009 Posted March 7, 2021 Solution Share Posted March 7, 2021 (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 January 4 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
hboss22 Posted March 8, 2021 Author Share Posted March 8, 2021 @paul2009 ahh I see. So it's not necessarily something that can be done once that will apply to every blog post. I'd have to do this for every single post? Link to comment
paul2009 Posted March 8, 2021 Share Posted March 8, 2021 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
hercegovka Posted January 4 Share Posted January 4 What is the CSS code to convert dates to show age - like "3 days ago?" Link to comment
creedon Posted January 4 Share Posted January 4 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
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment