Its that time of the year again where the footer copyright year in almost every website becomes automatically outdated!!
If you scroll to the bottom of your website, (most of the time) there is a notice there which has would usually be in the form, Copyright © 2021. Your Company Name.
While a lot of clients and website owners forget to do it the start of every year, you are meant to change the year in this notice to match the current year!
We made this post on Instagram after seeing the footer copyright year of a new client website we had a job to re-design & update still stuck at 2003!
View this post on Instagram
We would usually charge a small fee to update this every year but as business owners, we always help clients save money as we know every pence counts so what if we showed you how to get rid of paying this annual fee, forever?
You might be wondering, why is updating the footer copyright year important? It’s just a little part of the website?
Let’s look at it this way, if you were searching for a Software Developer for your business and found Target ICT and a few others online, after making comparisons you scrolled to the bottom of their websites and realized one of the companies still had year 2015 in their footer won’t you feel the company has gone out of business?
Apart from this, having this part of your website out of date can negatively affect your SEO (Search Engine) rankings.
That’s the same way a lot of potential clients might feel when they see outdated information on your Business website!
When we build websites for clients, we always make sure this inconvenience is eliminated completely by ensuring the year updates itself automatically.
In this post, you would see how that can be done on your website and we would cover the most popular languages websites are built in these days.
While so many websites are built on content management systems these days, there are others (like our main website) which are built with pure HTML/PHP/Javascript for ease of manipulation and to get rid of bloat.
In other to keep your copyright year updated, we would list instructions for some popular languages below – Javascript, PHP, Django, node.js and ASP.net.
If you are confused on how to make changes to your website you can check our previous post on that.
Javascript is a Client Side scripting language (it makes changes in the browser) which has been gaining a lot of popularity of recent.
We have a lot of websites built with plain javascript and the various frameworks such as React, Vue.js, Angular and the like.
The code for Javascript is as below (replace the year with the code below) :
To add just the year
<script type="text/JavaScript"> document.write(new Date().getFullYear()); </script>
This would give you
2021
To use a start and end year (e.g 2010 -2021)
© 2010<script>new Date().getFullYear()>2010&&document.write("-"+new ate().getFullYear());</script>, Your Company name.
This would come out as:
© 2010-2021, Your Company name.
Majority of the Websites online worldwide are built with or support PHP and this is likely to be the case for a very long time.
PHP unlike Javascript is a server side scripting language (code is translated at the server before the site is shown on the browser).
Like with Javascript, PHP has a lot of CMS (like WordPress, Joomla, etc) and frameworks (like Laravel, CakePHP, etc) but below, we would be giving the code to keep your footer year auto-updated with plain PHP.
To add just the year:
<?php echo date("Y"); ?>
This would show as:
2021
To use a start and end year (e.g 2010 -2021)
© <?php $fromYear = 2010; $thisYear = (int)date('Y'); echo $fromYear . (($fromYear != $thisYear) ? '-' . $thisYear : '');?>, Your Company name.
This would come out as:
© 2010-2021, Your Company name.
Node.js is one of the popular javascript frameworks used in building websites these days.
You can automate the footer date year in your Node.js application by using the following:
new Date().toISOString().substr(0,4)
This would show as:
2021
Python is a really popular multipurpose language which has gained attention of recent.
Django is a framework which is commonly used in building Python applications and to automate the footer in your Django application, you can use the following code to replace the year written:
{%now "Y"%}
This would show as:
2021
ASP. net has been used for decades in building web applications and the footer of an ASP enabled website can be automated by replacing the year typed there with the following code:
Copyright @@ @DateTime.Now.Year
This would show as:
Copyright 2021
That’s it!
1 less thing to bother about.
If you would like us to do this for you, you can always Contact Us.