#4 A Home Page; Building on the Base Page

Presented by David G.

This episode leverages Episode #3's Base Page to create a simple, authorable, Home Page implementation.

Using the sample static site as a guide, create a Home Page implementation and supporting Template on top of the Base Page implementation. This showcases how common elements can be inherited from the Base Page, while page-type specific elements can selectively applied.

Page Component Defintion

/apps/aemcasts/demo/components/content/page/landing/homepage/.content.xml

Defines Home page’s inheritance of Base page’s scripts.

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0"
	xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
	jcr:primaryType="cq:Component"
	jcr:title="AEM Casts Demo Home Page"
	sling:resourceSuperType="aemcasts/demo/components/page/basepage"
	/>

main.jsp overlay

The implementation of the Home page’s content area, overlaying the main.jsp of the Base Page by way of the above sling:resourceSuperType.

/apps/aemcasts/demo/components/content/page/landing/homepage/main.jsp

<%@include file="/apps/aemcasts/demo/global/global.jsp"%><%
%><%@page session="false"%><%
%>
<div class="grid_12">
    <div class="promo">
        <cq:include path="promo-text" resourceType="foundation/components/text"/>
    </div>
</div>

<section class="grid_8">
    <cq:include path="main-par" resourceType="foundation/components/parsys"/>
</section>

<aside class="sidebar grid_4">
    <cq:include path="sidebar-par" resourceType="foundation/components/parsys"/>
</aside>

Template Definition

Define the template that points to the Home page implementation.

/apps/aemcasts/demo/components/content/templates/homepage/.content.xml

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0"
	xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
	jcr:primaryType="cq:Template"
	jcr:title="AEM Casts Demo Home Page"
	jcr:description="AEM Casts Demo Home page - Contains the promo areas and a 2 column layout."
	 allowedPaths="[/content/aemcasts(/.*)]">
    <jcr:content jcr:primaryType="cq:PageContent"
		sling:resourceType="aemcasts/demo/components/page/landing/homepage"/>
</jcr:root>

Corrections

@4:15 - allowedParents

The allowParents property on the template .content.xml in the episode should be allowedPaths.