Cody CMS
Fork me on GitHub

First subitem

Q: What happens if I put the "Show" option to "First subitem" in the "Options" tab of a page?

-- First subitem

A: Instead of rendering the requested page, we render the first sub page of this item (if any). If this page also has this same option set, then we continu until we find a page with "Show" set to "Content" or until a page has no sub pages.

T: Code from the Page model.

 Page.prototype.getDisplay = function() {
  // check if this page is marked as: "show first subitem"
  if ((this.item.showcontent === cody.Item.kSubItem) && (this.children.length > 0)) {
    return this.children[0].getDisplay();
  } else {
    return this;