William Hammond provides us with a very handy code addition to automatically change the year accompanying your footer copyright.
Forgetting to update trifling elements of a web page is something that I am guilty of, as I am sure a lot of you are as well. But worry not, as I have a very quick and easy trick to alleviate at least some of that aggravation!
Its purpose is to automatically update the year in your footer; although it seems pedantic to automate such a minor detail, having to manually update every page on your website each subsequent year proves to be an exhausting task - especially for larger websites.
So without further adieu, here is the code to inject:
<p> © <!--copyright symbol--> <span id="currentYear">x</span> <!--current year--> <a href="https://www.yourwebsite.co.uk" target="_blank"> <!--link to your website--> Website by you.</a> </p>
<script> var currentYear = new Date().getFullYear(); //variable containing current year document.getElementById("currentYear").innerHTML = currentYear; //set specified HTML element to currentYear variable </script>
I hope you have found this useful!