Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Returns a list of pages associated with the given term or its children.
&outerTpl (string) Format the Outer Wrapper of List using a Chunk or a formatting string. (Optional). Default:
&innerTpl (string) Format the Inner Item of List using a Chunk or a formatting string. Default:
- &term_id (integer) Page id of the term (optional: defaults to the current page id)
- &exact_matches (boolean) if true, implied hierarchies are ignored and only pages assigned specifically to term_id will be returned. The default behavior is to return implied matches, which include pages associated with the Term's children. Default: false.
- &classname (string) Set this if you have created a custom join table used to associate taxonomy terms with something other than pages. (optional: default PageTerm)
- &debug (boolean) if set, will output debugging info including raw SQL query and parameter list.
- &limit (integer) Limit the result
- &sort (string) Sample Value, Page.id, Page.pagetitle. Just Add Page before the actual field name.
- &dir (string) ASC or DESC, default to ASC.
Note that the placeholders in the
innerTpl Chunk use a prefix of
Page. -- this is a by-product of the underlying SQL join that joins from the PageTerms to the Page. See usage examples below.
This Snippet is used to show all pages that have been associated with the given term_id or its children.
Commonly this Snippet would be placed on the Term pages themselves (or in the template used by the term pages).
Used on a Term page:
Specify a summary of a specific term:
Specify a custom format:
[[getPagesByTerm? &innerTpl=`<li><a href="[[~[[+Page.id]]]]">[[+Page.pagetitle]]</a></li>` ]]
Return only exact matches:
This alters the behavior of the matching. Normally, if you request pages matching the given term, the Snippet returns pages that match the term or the term's children. For example, searching for pages matching the "Mammals" term would by default also return "Dogs" (given that "Dogs" is a sub-term of "Mammals"). To bypass this hierarchical querying, set
&exact_matches to 1, and a page will be included in results only if it had been explicitly checked with the given term.
Show a message if no matches:
[[getPagesByTerm:empty=`Sorry, no matches`? &term_id=`123`]]