在AEM中添加自定义RSS源标记



我正在尝试在AEM中为RSS源添加自定义atom:tags

我已经覆盖了 OOTB 代码以从等效的路径/apps/cq/Page/feed.jsplibs

我能够从jcr-node中提取图像路径,但无法成功将其添加到自定义标签中。

如何在前缀原子的标签库中添加自定义标签?

进口

--%><%@ page session="false" %><%
%><%@ page import="com.day.cq.commons.Externalizer,
com.day.cq.wcm.api.Page,
com.day.cq.wcm.api.WCMMode,
java.util.Iterator,
javax.jcr.Node,
com.day.cq.wcm.api.components.ComponentContext" %><%
%><%@ taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0" %><%
%><%@ taglib prefix="cq" uri="http://www.day.com/taglibs/cq/1.0" %><%
%><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><%
%><%@ taglib prefix="atom" uri="http://sling.apache.org/taglibs/atom/1.0" %><%
%><cq:defineObjects /><%

自定义代码

Node jcrNode = currentNode.hasNode("jcr:content") ? currentNode.getNode("jcr:content") : null;
Node imageNode = jcrNode != null && jcrNode.hasNode("image") ? jcrNode.getNode("image") : null;
String image = imageNode != null && imageNode.hasProperty("fileReference") ?
imageNode.getProperty("fileReference").getValue().getString() : null;
%><atom:feed id="<%= url %>"><%
%><atom:title><c:out value="<%= title %>"/></atom:title><%
if (subTitle != null) {
%><atom:subtitle><c:out value="<%= subTitle %>"/></atom:subtitle><%
}
if (image != null) {
%><atom:image><c:out value="<%= image %>"/></atom:image><%
}
%><atom:link href="<%= link %>" rel="self"/><%

未识别图像标记

<atom:image></atom:image>

错误日志

.feed HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught SlingException
org.apache.sling.scripting.jsp.jasper.JasperException: /apps/cq/Page/feed.jsp(60,18) No tag "image" defined in tag library imported with prefix "atom"

atom:image不是Atom联合格式的一部分。请参阅 Atom 联合格式。看看atom:iconatom:logo

最新更新