Jump to content

jcweaver

Member
  • Posts

    3
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

jcweaver's Achievements

Level 1

Level 1 (1/20)

1

Reputation

  1. @Linds3yjo I'm not sure if you are still looking to do this, but feel free to check out the code I shared here: You will need to make one change to replace the dateStyle 'long' with 'full' to show the day of the week.
  2. Squarespace actually puts the full blog post publication date on every blog page in a meta element with an itemprop='datePublished'. If you search for this item and get the content attribute, you can use this to inject into the published date element. <script> //only run the code after the dom has loaded document.addEventListener('DOMContentLoaded', function() { //get the blog post html item so that we can later replace this with the full published date var pubdate = document.getElementsByClassName("blog-meta-item--date"); //get the published info from the meta property on the page var datePublishedMeta = document.querySelector('meta[itemprop="datePublished"]'); for (var i = 0; i < pubdate.length; i++) { if (datePublishedMeta){ //turn the meta date into a Date item so we can restyle it var d = new Date(datePublishedMeta.getAttribute('content')); //Set the dateStyle. I prefer 'long' to display the full month like March instead of Mar pubdate[i].innerText = d.toLocaleString('default', {dateStyle: 'long'}); } } }); </script>
  3. Hello, I'd like to target specific classes with custom CSS only when they show on blog pages. I am already targeting specific CSS classes with custom CSS when they are on a specific regular Squarespace page using #collection-6490ee41267056672611735a{ [css classes]} but I'm not sure if there is a collection ID or how to find it for specific blog pages (i.e. the pages that you navigate to after clicking on a blog in a collection item). Thanks for the time!
×
×
  • 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.