AEM - Auto update Year in Copyright in the Footer | Community
Skip to main content
Level 4
July 10, 2019

AEM - Auto update Year in Copyright in the Footer

  • July 10, 2019
  • 1 reply
  • 5876 views

In AEM content page, there is a footer which shows the copyright with “year”.  We want to auto-update copyright “Year”. Currently, we are authoring footer year in the authoring dialog. I know we can achieve on the client side, is there any way to achieve the same on the AEM server side?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Ravi_Pampana
Community Advisor
Community Advisor
July 10, 2019

Hi,

In java side you can populate year as below and use that in the footer.html/.jsp

int year = Calendar.getInstance().get(Calendar.YEAR);

Note: This requires dispatcher cache to be cleared and top of any additional cdn cache your site may have to reflect the latest year

Hope this helps!

karanmahiAuthor
Level 4
July 10, 2019

I thought the same, but I am seeing two issues -

1. Currently, We are authoring the "Copyright © 2017 ARCT Corporation" in Rich Text editor, which I am displaying in HTML. Now, how to break this string and append year(from java class) as you mentioned because "year" is in-between the String, after "Copyright © "?

2. And how do we ensure that that author can author rest of the part in Rich text editor except year?

joerghoh
Adobe Employee
Adobe Employee
July 10, 2019

In that case you need to redesign your page footer. You need to define clearly which part can be authored, and which part is managed / created / authored by AEM itself. At least that would be the cleanest way.

Do you maintain the page footer per page? Why don't you maintain it centrally -- once for all pages?