The Website Copyright adds ownership to the site content and it is crucial to reinstate it every year. An updated copyright not only shows that the site is maintained but also gets it rated high on SEO search lists. An annual task for all website owners is to update the copyright year across websites. As a webmaster, you may find it a frustrating task to do it on time year after year. Let us explore some of the ways to auto update the copyright year on a website.
The Copyright information on a website provides useful information about copyright ownership on the website content. It establishes the creator of that content and also the year the content was originally created. The Website copyright protects the owner‘s rights to the content, logos, images on the website.
The Copyright can be a single year which is the year the site was created. A range of years specifies the year of publishing through the year the content was last revised. If your website has been up for more than a year then it is advisable to show the date range instead of the current year.
Copyright information establishes your right over the content on your website. It is also important legally if you face the issue of content stolen from the website. An outdated copyright will no longer uphold your ownership of the site content making it vulnerable to thefts.
Displaying the correct range on the website copyright year gives an idea of the time period the business has been running. An outdated copyright year would give a perception that the site is not maintained and information might not be accurate. An updated copyright year helps establish visitor trust and strengthen the image of the site.
The website footer element contains the current year or range of years for which the website’s copyright is valid. You should auto-update copyright year annually either manually or dynamically using a script or CMS.
Add this code at the ending tag of body :
<script>
var year_started = 2021; // The year the company/web started
var dt = new Date(); // Using JavaScript Date Function we get TODAY'S DATE
var year_now = dt.getFullYear(); // We get JUST the year from our full date
if(year_now == year_started){ // With If Conditionals we look if the year we started company is the same as today's year
var copyr = "Your Comp. © " + year_started; // IF YES we return this STRING, with just the copyright and the year we started
}
else{ // We can use ELSE for the OTHER OPTIONS;
var copyr = "Your Comp. © " + year_started + "-" + year_now; // If the year is not the same as the started year we return this string
}
document.getElementById("copyright").innerHTML = copyr; // Using "document.getElementById("copyright").innerHTML" we sent this string to the paragraph element with ID="copyright" in HTML
</script>
Using php we can add Range of years:
<?php
$started_year = 2021; // The year the company/web started
$year_now = date('Y'); // Using php Date Function we get the TODAY'S YEAR
if($started_year == $year_now){
?>
<p class="copyright" id="copyright"><?php echo "Your Comp. © ".$started_year ?></p>
<?php
} else{
?>
<p class="copyright" id="copyright"><?php echo "Your Comp. © ".$started_year."-".$year_now ?></p>
<?php
}
?>
Have a look at website: https://autoupdatecopyrightyear.netlify.app/
Get the files: https://github.com/denishotii/update-copyright-year.git