Content Marketing

How To Keep Your Copyright Date Updated Programmatically On Your Website or Online Store

We’ve been hard at work developing a Shopify integration for a client that’s quite robust and complex… more to come on that when we publish it. With all the development we’re doing, I was embarrassed when I was testing their site to see the copyright notice in the footer was out of date… showing last year instead of this year. It was a simple oversight as we had coded a text input field to display and just hard-coded the year in there to get them live.

Shopify Template: Publish Copyright Symbol and Current Year With Liquid

Today, I updated the theme Shopify template to automatically keep the copyright year up to date and append the appropriate text from the text field. The solution was this little snippet of liquid script:

©{{ "now" | date: "%Y" }} DK New Media, LLC. All Rights Reserved

Here’s the breakdown:

  • The ampersand and copy; is called an HTML entity and is the appropriate method to display the copyright symbol © for all browsers to display it correctly.
  • The liquid snippet uses “now” to get the server’s current date and the element date: “%Y” formats the date as a 4-digit year.

WordPress Theme: Publish Copyright Symbol and Current Year With PHP

If you’re using WordPress, the solution is just a PHP snippet:

&copy;<?php echo date("Y"); ?> DK New Media, LLC. All Rights Reserved
  • The ampersand and copy; is called an HTML entity and is the appropriate method to display the copyright symbol © for all browsers to display it correctly.
  • The PHP snippet uses “date” to get the server’s current date and the element date: “Y” formats the date as a 4-digit year.
  • We just added our business and All Rights Reserved rather than programming a setting in our theme… of course, you could do that as well.

Programmatically Publish Copyright Symbol and Current Year in ASP

<% response.write ("&copy;" & Year(Now)) %> DK New Media, LLC. All Rights Reserved

Programmatically Publish Copyright Symbol and Current Year in .NET

<%="&copy;" & DateTime.Now.Year %> DK New Media, LLC. All Rights Reserved

Programmatically Publish Copyright Symbol and Current Year in Ruby

&copy;<%= Time.now.year %> DK New Media, LLC. All Rights Reserved

Programmatically Publish Copyright Symbol and Current Year in JavaScript

&copy; <script>document.write(new Date().getFullYear());</script> DK New Media, LLC. All Rights Reserved

Programmatically Publish Copyright Symbol and Current Year in Django

&copy; {% now "Y" %} DK New Media, LLC. All Rights Reserved

Programmatically Publish Copyright Symbol and Current Year in Python

from datetime import date
todays_date = date.today()
print("&copy;", todays_date.year)
print(" DK New Media, LLC. All Rights Reserved")

Programmatically Publish Copyright Symbol and Current Year in AMPscript

If you’re using Marketing Cloud, you can use this method in your email templates.

&copy; %%xtyear%% DK New Media, LLC. All Rights Reserved

Regardless of your app, content management system, e-commerce, or email platform, I’d encourage you to always programmatically update your copyright year. And of course, if you need some help on this – feel free to reach out to my firm DK New Media. We don’t do one-off small projects but can implement this as part of a larger project you might have.

Douglas Karr

Douglas Karr is CMO of OpenINSIGHTS and the founder of the Martech Zone. Douglas has helped dozens of successful MarTech startups, has assisted in the due diligence of over $5 bil in Martech acquisitions and investments, and continues to assist companies in implementing and automating their sales and marketing strategies. Douglas is an internationally recognized digital transformation and MarTech expert and speaker. Douglas is also a published author of a Dummie's guide and a business leadership book.

Related Articles

Back to top button
Close

Adblock Detected

Martech Zone is able to provide you this content at no cost because we monetize our site through ad revenue, affiliate links, and sponsorships. We would appreciate if you would remove your ad blocker as you view our site.