AEM - Auto update Year in Copyright in the Footer

Avatar

Avatar

karanmahi

Avatar

karanmahi

karanmahi

10-07-2019

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?

Replies

Avatar

Avatar

Ravi_Pampana

MVP

Avatar

Ravi_Pampana

MVP

Ravi_Pampana
MVP

10-07-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!

Avatar

Avatar

karanmahi

Avatar

karanmahi

karanmahi

10-07-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?

Avatar

Avatar

Jörg_Hoh

Employee

Total Posts

3.0K

Likes

991

Correct Reply

1.0K

Avatar

Jörg_Hoh

Employee

Total Posts

3.0K

Likes

991

Correct Reply

1.0K
Jörg_Hoh
Employee

10-07-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?