private PageTemplate createPageTemplate() { final PropertyTree pageTemplateConfig = new PropertyTree(); pageTemplateConfig.addLong("pause", 10000L); PageRegions pageRegions = PageRegions.create() .add( Region.create() .name("main-region") .add(PartComponent.create().name(ComponentName.from("mypart")).build()) .build()) .build(); final PageTemplate.Builder builder = PageTemplate.newPageTemplate() .key(PageTemplateKey.from("abc")) .canRender(ContentTypeNames.from("myapplication:article", "myapplication:banner")) .regions(pageRegions) .config(pageTemplateConfig); builder.controller(DescriptorKey.from("mainapplication:landing-page")); builder.displayName("Main page template"); builder.displayName("Main page template"); builder.name("main-page-template"); builder.parentPath(ContentPath.ROOT); return builder.build(); }
private PageTemplate createPageTemplate() { return PageTemplate.newPageTemplate() .key(PageTemplateKey.from("my-page")) .controller(DescriptorKey.from("myapplication:mypagetemplate")) .name("my-page-template") .parentPath(ContentPath.ROOT) .build(); }
public static Builder create(final ContentTypeName type) { if (type.isPageTemplate()) { final PageTemplate.Builder builder = PageTemplate.newPageTemplate(); builder.type(type); return builder; } else if (type.isSite()) { Site.Builder builder = Site.create(); builder.type(type); return builder; } else if (type.isDescendantOfMedia()) { Media.Builder builder = Media.create(); builder.type(type); return builder; } else { Builder builder = Content.create(); builder.type(type); return builder; } }