Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0
PurposelyAwakened

How do I add the blog year to the Skye template?

Question

We are trying to and need to have the year after the date in a blog post. We are using the Skye Template. For example, the date just shows "Oct 2" how do we get it to display "Oct 2, 2019"?

Edited by PurposelyAwakened

Share this post


Link to post

4 answers to this question

Recommended Posts

  • 0

This can be done with some Javascript. Read the datetime attribute, extract the year and append it to the date displayed in the date-callout. You'll need to find all matching elements if you want to do this on the blog list page, or just once if you only need it when the full blog article is being shown.

People in the community generally need a working link to the site to be able to provide a working solution.

 


World-class Squarespace Developer and Squarespace Circle Leader with a strong reputation on the Squarespace Forum.
I'm trusted by hundreds of Squarespace users worldwide, including designers, freelancers, business owners and big agencies.

I can tackle anything from small tweaks to full websites and I'm available for short and long bookings (min. 1 hour).
Book via my website giving as much notice as possible. Note that I'm currently booked until the middle of April 2020.
Prebuilt Squarespace Extensions
Custom Squarespace Extensions: Tell me about the functionality you need

**NEW** Our popular Enquiry Form ExtensionDate Picker Extension and Age Verification Extension are now Squarespace 7.1 compatible.

Share this post


Link to post
  • 0

I know this post is a little old, but since I just spent the time doing it, here's some code you can inject into the page header to add the year to the date output on Skye's blog listings. You'll want to add it to the "Page Header Code Injection" area (for the blog listing page, not on an individual blog post).

<style type="text/css">
.day:after {
  content: ',';
}
</style>
<script
  src="https://code.jquery.com/jquery-3.4.1.min.js"
  integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
  crossorigin="anonymous"></script>
window.onload = init;
  
function init() {
    var $year = $('.dt-published').map(function() {
  return $(this).attr('datetime').substr(0,4);
}).get();

    $( '.date-wrapper' ).each( function ( i ) {
        $( this ).append( '<span class="year">' + $year[i] + '</span>');
    });
}
</script>

Hopefully others get some benefit from it!

Edited by kristi-lynn
Updated Jquery version

Share this post


Link to post
  • 0
19 minutes ago, kristi-lynn said:

<script src="//code.jquery.com/jquery-2.2.1.min.js"></script>

@kristi-lynnIf your code requires jQuery, I recommend you swap for the latest production release (3.4.1 at the time of writing).

The older version you've posted has two medium-severity security vulnerabilities


World-class Squarespace Developer and Squarespace Circle Leader with a strong reputation on the Squarespace Forum.
I'm trusted by hundreds of Squarespace users worldwide, including designers, freelancers, business owners and big agencies.

I can tackle anything from small tweaks to full websites and I'm available for short and long bookings (min. 1 hour).
Book via my website giving as much notice as possible. Note that I'm currently booked until the middle of April 2020.
Prebuilt Squarespace Extensions
Custom Squarespace Extensions: Tell me about the functionality you need

**NEW** Our popular Enquiry Form ExtensionDate Picker Extension and Age Verification Extension are now Squarespace 7.1 compatible.

Share this post


Link to post

Create an account or sign in to comment

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


×
×
  • Create New...