Web Dev Notes

Blog about web development by Robert Dawson

How to automatically update the copyright year on Squarespace

Question

It's 2012 and your copyright year still reads 2011. You vaguely remember that computers allegedly save time. So, you wonder if there might be an easy way to automatically display the current year and save yourself a few clicks and minutes each year.

Answer

There is! And it's easy. JavaScript 101 easy. No, jQuery 101 easy!

Note: This assumes you have jQuery installed. If not, see this post. Also, this solution basically applies to any site with jQuery.

Step 1: Add container element

  1. Go to Website Management > Structure > Website Settings > Header & Footer Website Footer / Licensing Notice
  2. Paste this:
    Copyright &copy; <span class="current-year"></span>
    

Step 2: Add jQuery

  1. Go to Website Management > Structure > Website Settings > Code Injection
  2. Paste this:
    <script type="text/javascript">
    $(function(){
      $('.current-year').html((new Date).getFullYear());
    });
    </script>