Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

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:

© 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

 DK New Media, LLC. All Rights Reserved

Programmatically Publish Copyright Symbol and Current Year in .NET

 DK New Media, LLC. All Rights Reserved

Programmatically Publish Copyright Symbol and Current Year in Ruby

© DK New Media, LLC. All Rights Reserved

Programmatically Publish Copyright Symbol and Current Year in JavaScript

©  DK New Media, LLC. All Rights Reserved

Programmatically Publish Copyright Symbol and Current Year in Django

© {% 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("©", 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.

© %%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 Highbridge. We don’t do one-off small projects but can implement this as part of a larger project you might have.

© 2021 DK New Media, LLC, All Rights Reserved



This post first appeared on How To Optimize Prestashop For Increased SEO And Conversions, please read the originial post: here

Share the post

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

×

Subscribe to How To Optimize Prestashop For Increased Seo And Conversions

Get updates delivered right to your inbox!

Thank you for your subscription

×