使用 Sightly 的模板叠加

Template overlay using Sightly

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

我一直关注到 "Using your own scripts" 步。当我尝试使用 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 并改用 sightly 脚本?我怀疑某处可能有一个 components/page/body.html,但不知道在哪里寻找它(以防它真的存在)。

谢谢。

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

这是一篇让我走上正轨的文章的 link,以防对其他人有用:http://scottwestover.blogspot.co.uk/2015/04/aem-tutorial-on-building-sightly-page.html