Pages API

by Justin Bodeutsch, Benson Lee | Last edited: 4/20/2020

Display mode: list

The pages API supports display modes of: list, detail, and categories. If no parameter is provided it will default to detail.

Show

Here are the tags available to show in page list:

Tag Description
__id__ the page ID
__title__ the page title
__slug__ the URL safe version of the title (more info)
__url__ A full path to the page. If the page lives in multiple places in the nav, just one will be returned.
__groupslug__ returns group slug this page belongs to. Will not return site-group. If the page is associated with multiple groups, will return the first group associated in alphabetical order.
__groupslugs__ returns a comma separated list of group slugs this page belongs to.
__description__ the page description
__tags__ Comma separated list of keywords
__taglinks__ Comma separated list of keywords in links. By default links to /tags/tag-slug/. Otherwise use __taglinks url='/some/url/'__
__category__ A comma separated list of this page's categories
__categoryslug__ A comma separated list of this page's slugified categories
__categorylinks__ comma separated list of linked categories. Use parameter 'path' to specify where links will go, default is '/pages/category/'. Use 'separator' to use a different separator than comma.
__categorytitlelinks__
__categoryX__ Will be repeated once for each category assigned
__categoryXslug__
__parentcategoryX__ Will be repeated once for each parent category
__parentcategoryXslug__
__parentcategoryXchildX__ Will be repeated once for each child category, nests under the parent category
__parentcategoryXchildXslug__
__lastrevisiondate__ Returns the date of the last time the page was revised. The date is forgettable Use __lastrevisiondate format='j/m/Y'__ a complete list</a > of tags is available
__text__ The page content
Any Custom Fields setup for Pages will output their API tags

Parameters

howmany

Sets the maximum number of items to display

Example:

"howmany:3",

 

find_category

Only show items assigned to that category. Can find multiple categories with a comma separated list. If category slugs are separated by , or || any item assigned to ANY specified category is returned. If && is used to separate only items assigned to ALL specified categories will be returned.

Example:

"find_category:category1,category2,category3",

"find_category:category1 && category2 && category3",

find_parent_category

Will return all records assigned directly to the parent OR to any of its children.

Example:

"find_parent_category:parent-category",

hide_category

Will not show items assigned to that category.

Example:

"hide_category:category-slug,category-slug2",

order

Sets sort order of items in list. By default will show the oldest items first.

item description
recent or modified by date, starting with most recent
random returns a random list
title by title, in alphabetical order

 

Display mode: detail

Show

Here are the tags available to show in page detail:

__groupslugs__returns a comma separated list of group slugs this page belongs to.

Tag Description
__id__ the page ID
__title__ the page title
__slug__ the URL safe version of the title (more info)
__url__ A full path to the page. If the page lives in multiple places in the nav, just one will be returned.
__groupslug__ returns group slug this page belongs to. Will not return site-group. If the page is associated with multiple groups, will return the first group associated in alphabetical order.
__description__ the page description
__tags__ Comma separated list of keywords
__taglinks__ Comma separated list of keywords in links. By default links to /tags/tag-slug/. Otherwise use __taglinks url='/some/url/'__
__category__ A comma separated list of this pages categories
__categoryslug__ A comma separated list of this pages slugified categories
__categorylinks__ comma separated list of linked categories. Use parameter 'path' to specify where links will go, default is '/pages/category/'. Use 'separator' to use a different separator than comma.
__categorytitlelinks__
__categoryX__ Will be repeated once for each category assigned
__categoryXslug__
__parentcategoryX__ Will be repeated once for each parent category
__parentcategoryXslug__
__parentcategoryXchildX__ Will be repeated once for each child category, nests under the parent category
__parentcategoryXchildXslug__
__lastrevisiondate__ Returns the date of the last time the page was revised. The date is forgettable Use __lastrevisiondate format='j/m/Y'__ a complete list</a > of tags is available
__text__ The page content
Any Custom Fields setup for Pages will output their API tags

Parameters

find

Will accept the slug of a page or a page ID. Typically will be used to dynamically find current page. 

Slug example:

"find:page-slug",

ID example:

"find:p-692030",

Dynamically find the current page:

"find:".$_GET['nav'],

Header Images

Pages also support header images. This code snippet pulls the header image associated with the current page:

getContent(
      "media",
      "display:detail",
      "find:".$_GET['nav'],
      "label:header",
      "show:<img src="__imageurl__" alt="__name__" id="subpage_header" />"
    );

User-Selectable Sections

Templates enabled for pages can also support sections that users can select on a per-page basis. See the Sections API for more information on this capability.

 

Display mode: categories

Show

level#
TagDescription
__bid__ Internal system ID of the category for unique identification.
__count__ Numerical count of the articles belonging directly to the category.
__level__ Hierarchical level of the category. The root level is considered level 1.
__name__ Name of the category as entered in the backend.
__parentid__ Internal system ID of the category's parent. This is set to '0' if the category has no parent.
__slug__ Slugged version of the category name.

Parameters

parent_category

Specifies the parent category slug to use as the hierarchical root to start from.

Example:

"parent_category:slugged-category-name",

Full Example

getContent(
   "MODULETYPE",
   "display:categories",
   "level1:Parent: __name__ (__count__) ",
   "level2:Child: __name__",
   "level3:Grandchild: __name__",
);