在AEM中添加自定义RSS feed标签

问题描述 投票:0回答:1

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

我已从等效的/apps/cq/Page/feed.jsp路径中将OOTB代码覆盖到libs

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

如何在标签库中为前缀atom添加自定义标签?

进口

    --%><%@ 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"
rss aem feed atom-feed
1个回答
0
投票

atom:image不是Atom联合格式的一部分。参见The Atom Syndication Format。看看atom:iconatom:logo

© www.soinside.com 2019 - 2024. All rights reserved.