@Override @JsonIgnore public String getName() { return page.getName(); }
@Override public String getTitle() { String title = currentPage.getTitle(); if (StringUtils.isBlank(title)) { title = currentPage.getName(); } return title; }
private Map<String, String> getPageProperties(Page page) { Map<String, String> properties = new HashMap<>(); properties.put(JSON_KEY_NAME, page.getName()); properties.put(JSON_KEY_TITLE, page.getTitle()); properties.put(JSON_KEY_PAGE_TITLE, page.getPageTitle()); properties.put(JSON_KEY_PATH, page.getPath()); properties.put(JSON_KEY_DESCRIPTION, page.getDescription()); return properties; } }
public String getTitle() { return StringUtils.defaultIfBlank(StringUtils.defaultIfBlank(page.getPageTitle(), page.getTitle()), page.getName()); }
@Override public void addBindings(Bindings bindings) { log.info("In CustomBindingProvider.."); if ( bindings.containsKey(WCMBindings.CURRENT_PAGE)) { log.info("Currentpage does exist.."); // there is the currentPage bindings from Sightly Page current = (Page) bindings.get(WCMBindings.CURRENT_PAGE); // adapt this to MyCustomPage, and add this to the bindings bindings.put("pageName", current.getName()); bindings.put("myPage", current.adaptTo(MyCustomPage.class)); // you can now refer to pageName and myPage in every HTML file // example ${pageName} ${myPage.title} } else { log.info("Currentpage does not exist"); } } }
private Reference getReference(Page page) { return new Reference(TYPE_PAGE, String.format("%s (Page)", page.getName()), page.getContentResource(), getLastModifiedTimeOfResource(page)); }
private Reference getReference(Page page) { return new Reference(TYPE_PAGE, String.format("%s (Page)", page.getName()), page.getContentResource().getParent(), getLastModifiedTimeOfResource(page)); }
@Override public String getTitle() { String title = page.getNavigationTitle(); if (title == null) { title = page.getPageTitle(); } if (title == null) { title = page.getTitle(); } if (title == null) { title = page.getName(); } return title; }
public List<City> findCities(String basePath, String relPath) { List<City> cities = new ArrayList<>(); Resource resource = resourceResolver.getResource(basePath); Page page = resourceResolver.adaptTo(PageManager.class).getContainingPage(resource); Iterator<Page> cityPages = page.listChildren(); while (cityPages.hasNext()) { Page cityPage = cityPages.next(); ValueMap cityProps = cityPage.getContentResource().getValueMap(); City city = new City(); city.name = cityProps.get("jcr:title", String.class); city.id = cityPage.getName(); Resource cityView = cityPage.getContentResource().getChild(relPath); Download download = new Download(cityView.getChild("image")); city.imageSrc = download.getHref(); cities.add(city); } return cities; } }
@PostConstruct protected void initModel() { title = currentPage.getTitle(); if (StringUtils.isBlank(title)) { title = currentPage.getName(); } Tag[] tags = currentPage.getTags(); keywords = new String[tags.length]; int index = 0; for (Tag tag : tags) { keywords[index++] = tag.getTitle(currentPage.getLanguage(false)); } if (currentDesign != null) { String designPath = currentDesign.getPath(); if (!Designer.DEFAULT_DESIGN_PATH.equals(designPath)) { this.designPath = designPath; if (resolver.getResource(designPath + "/static.css") != null) { staticDesignPath = designPath + "/static.css"; } loadFavicons(designPath); } } populateClientlibCategories(); templateName = extractTemplateName(); }
page.getNavigationTitle(), page.getName());
/** * Generate JSON object for page * @param page Page * @return JSON object * @throws JSONException JSON exception */ protected final JSONObject getPage(Page page) throws JSONException { Resource resource = page.adaptTo(Resource.class); JSONObject pageObject = new JSONObject(); // node name pageObject.put("name", page.getName()); // node title text String title = page.getTitle(); if (StringUtils.isEmpty(title)) { title = page.getName(); } pageObject.put("text", title); // resource type pageObject.put("type", resource.getResourceType()); // template String template = page.getProperties().get(NameConstants.PN_TEMPLATE, String.class); if (StringUtils.isNotEmpty(template)) { pageObject.put("template", template); } // css class for icon pageObject.put("cls", "page"); return pageObject; }
page.getNavigationTitle(), page.getName());