PagelistByCategory
Questions answered by this recipe
How do I list pages by category?
Description
Use the following page list template to create a list of pages by Category.
Installation
Add the following to your page
>>comment<< [[#listbycategory]] (:template defaults group=Category name=-Category.{$DefaultName} order=$Name ForGroup={$Group} ForName=*:) (:template each:) (:pagelist group={$$ForGroup} name={$$ForName} link={=$FullName} ForCategory="{=$Namespaced}" fmt={$Group}.{$Name}#listofcategory count={$$ForCount}:) [[#listbycategoryend]] >><< >>comment<< [[#listofcategory]] (:template defaults group={$Group} order=$Name:) (:template first:) !! [[Category/{$$ForCategory}]] (:template each:) * [[{=$FullName} | {=$Titlespaced}]] (:template last:) [[#listofcategoryend]] >><<
Configuration
The pagelist parameters ForGroup
and ForName
specify the groups and pages for which the list by category is to be created.
The pagelist parameter name
can be used to include or exclude categories.
The pagelist parameter group
is by default the Category group.
Usage
Use the recipe as follows, adjusting the markup to suit
(:div190 class=smaller:) (:pagelist ForGroup={$Group} ForName=-Template,-SideBar,Pagelist* name=-{$DefaultName},PageList fmt={$Group}.{$Name}#listbycategory ForCount=1 count=1:) (:div190end:)
Notes
Two levels of pagelist are required.
The first (invocation) pagelist enumerates the category pages.
The second (embedded) pagelist checks the category backlinks that confirm a page is categorised.
Pages with no categories are omitted.
On large wikis this recipe may fail by running out of memory. For example even at its most reduced with counts of 1, only one category (PageList), and restricted pages (Cookbook/Pagelist*), as shown in the invocation above it does not run on PmWiki.
Change log / Release notes
See also
- Pagelist Auth List Short Display, in brief format, the permissions settings for pages that have permissions set.
- PagelistByCategory List pages by Category
- PagelistCalendar Use PageTextVariables and ftime markup expression to create a calendar where each event has its own page.
- PagelistCount Get pagelist to return a count of pages (deprecated)
- PageListExtensions Many Pagelist Enhancements
- PageListMultiTargets Enable multiple pages and wildcards in PageList
- PagelistNotes Notes on page lists
- PageListPlus Extend pagelist with various capabilities
- Pagelist Random Image Select an image randomly from all pages with images and display
- Pagelist Recent Changes A recent changes page created using Page lists
- Pagelist Site Map Create a sitemap using the page list directive
- Pagelist Template Samples Custom templates for pagelists formats
- PageListWikiTrail Enable a WikiTrails markup to use a (:pagelist ... :) directive
Contributors
Comments
See discussion at PagelistByCategory-Talk
User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.