Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

AEM - Auto update Year in Copyright in the Footer

Avatar

Level 4

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?

3 Replies

Avatar

Community Advisor

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

Level 4

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

Employee Advisor

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?