I am trying to add a last-modified date to the html source code of the pages served by our CMS (Jahia) so that it appears as an attribute in the response header.
This is needed for our search engine indexation.
I have tried adding in the head tag the following syntaxes but none allow a modified date to appear in the response headers:
<meta name="dcterms.modified" content="Mon, 09 Apr 2018 11:41:11 GMT">
<meta name="DCTERMS.modified" content="Mon, 09 Apr 2018 11:41:11 GMT">
<meta http-equiv="last-modified" content="Mon, 09 Apr 2018 11:41:11 GMT">
<meta http-equiv="Last-Modified" content="Mon, 09 Apr 2018 11:41:11 GMT">
(these dates are resolved from the fmt:formatDate pattern = "EEE, dd MMM yyyy HH:mm:ss z").
Am I incorrectly assuming that a meta tag added inside the head tag can be added to the header? I read on the W3Schools site that the only attributes for http-equiv are
<meta http-equiv="content-type|default-style|refresh">
so that is probably why that syntax doesn't work (although I can find references to it on the web).
Thanks in advance for your help.
Following help from the Jahia support team I added a filter class with source code to add the last modified date to the response headers and added the class to the configuration.
First you have to add a spring configuration. You can put it in a xml file in \src\main\resources\META-INF\spring
then add the filter class (inherits from AbstractFilter class) that uses the addDateHeader method,
This class makes reference to a custom taglib (NewestLastModifTag) which ensures that all subnodes are queried to get the last modified date