模板叠加使用Sightly

时间:2016-02-18 14:13:00

标签: cq5 aem

我对AEM很新。我正在关注官方文档中的this tutorial。我已经从上到下做过了,但现在我想再次尝试,但是使用Eclipse,Maven和Sightly而不是JSP。

我一直在关注“使用您自己的脚本”步骤。当我试图使用Sightly而不是JSP时,我最终得到了以下文件:

contentpage.html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
    <div data-sly-include="head.jsp" data-sly-unwrap></div>
    <div data-sly-include="body.jsp" data-sly-unwrap></div>
</html>

body.jsp

<%@include file="/libs/foundation/global.jsp"%>
<%
%><body>
    <div id="CQ">
        <div class="topnav">topnav</div>
        <div class="content">
            <cq:include script="left.html" />
            <cq:include script="center.html" />
            <cq:include script="right.html" />
        </div>
        <div class="footer">
            <div class="toolbar">toolbar</div>
        </div>
    </div>
</body>

left.html

<div class="left">
    <div>logo</div>
    <div>newslist</div>
    <div>search</div>
</div>

center.html

<div class="center">
    <div>trail</div>
    <div>title</div>
    <div>parsys</div>
</div>

right.html

<div class="right">
    <div>iparsys</div>
</div>

此外,节点apps / myproject / components / contentpage具有属性sling:resourceSuperType="foundation/components/page",因此它继承自提供的页面组件。

一切都按预期工作,但正如我之前所说,我只是尝试使用Sightly,但目前我已经得到了文件body.jsp,我认为我需要它是JSP所以它有与/libs/foundation/components/page/body.jsp同名。

有没有办法摆脱body.jsp并使用正确的脚本代替?我怀疑在某处可能有一个components/page/body.html,但不知道在哪里寻找它(如果确实存在的话)。

感谢。

1 个答案:

答案 0 :(得分:1)

rakhi4110评论,并且正如我所怀疑的那样,页面组件有一个明显的版本。它位于wcm/foundation/components/page中,因此唯一要做的就是继承而不是foundation/components/page

这是指向我的文章的链接,以防其他人使用:http://scottwestover.blogspot.co.uk/2015/04/aem-tutorial-on-building-sightly-page.html

相关问题