Creating custom template for teaser pages

Avatar

Avatar

Joel_Triemstra1

Avatar

Joel_Triemstra1

Joel_Triemstra1

15-10-2015

When authors create Teaser Pages, by default they are set to use the default design. I'd like them to use the design I've specified for my code base, so I tried creating a new template to specify a resource type of the built-in teaserpage, but a design path for my project. As far as I can tell, this XML replicates the structure of /libs/cq/personalization/templates/teaser, but my new template is not showing up in the list of templates when I try to create a Teaser/Offer page under a Campaign.

Is this intended behavior?

<?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" jcr:primaryType="cq:Template" jcr:title="Project Teaser Page" ranking="{Long}1000" jcr:description="Project sites should use this instead of the built-in Offer Page" allowedParents="[/libs/cq/personalization/templates/campaign,/libs/cq/personalization/templates/experience,/libs/cq/personalization/templates/offerlibrary]"> <jcr:content jcr:primaryType="cq:PageContent" sling:resourceType="cq/personalization/templates/teaserpage" cq:designPath="/etc/designs/client/project"/> </jcr:root>

Thanks

View Entire Topic

Avatar

Avatar

mohanr80993572

Avatar

mohanr80993572

mohanr80993572

15-10-2015

I guess you can achieve this by Overlaying campaign, teaser and brand templates. I tried this and it worked for me. Here are the steps:
1. Copy /libs/mcm/templates/brand to /apps/cq/mcm/templates/brand and make the following changes
    a. Add /apps/cq/personalization/templates/campaign to allowedChildren
    b. Add /content/demo/campaigns to allowedPaths
    c. Give your custom "jcr:title" to your "brand" template
2. Copy /libs/cq/personalization/templates/campaign to /apps/cq/personalization/templates/campaign and make the following changes
    a. Add /apps/cq/mcm/templates/brand to allowedParents
    b. Add /content/demo/campaigns(/[^/]*)? to allowedPaths
    c. Give your custom "jcr:title" to your "campaign" template
3. Copy /libs/cq/personalization/templates/teaser to /apps/cq/personalization/templates/teaser and make the following changes
    a. Add /apps/cq/personalization/templates/campaign to allowedParents
    b. Give your custom "jcr:title" to your "teaser" template
4. Now create a "brand" under /content/demo/campaigns which is your custom path.
5. Then create a "campaign" inside brand.
6. Then create a "teaser" inside campaign.

There is no risk involved in the above process as per my knowledge.
Note: Official recommendation is not to create any custom components/templates/nodes etc under /libs/...
      The risk involved in this is "the content of /libs is overwritten the next time you upgrade your instance (and may well be overwritten when you apply either a hotfix or feature pack)". Reference: https://docs.adobe.com/docs/en/cq/5-6-1/developing/developing_guidelines_bestpractices.html