Help:Dynamic Page Lists
When you add a Dynamic Page List, it is recommended to switch the editor to wikitext mode. |
Note: Starting from mediawiki version 1.35, the new DPL will automatically default to cache in 1 hour. What this means is when you add a new wiki page, it may take up to 1 hour to reflect the new result on the DPL.This function is to prevent the wiki server from overloading. See I added a new page but it is not showing up in the DPL? for the workaround. |
Dynamic Page List (DPL) is a tool for listing multiple articles on a wiki that fit certain categories and other criteria. In its most basic form, DPL displays a list of pages in one or more categories. Page lists may also be based on factors such as author, namespace, date, name pattern, usage of templates or references to other articles. Output takes a variety of forms, some of which incorporate elements of selected articles.
Examples of Basic DPL Code
Below are some examples of basic DPL code. You can copy and paste the code into any pages.
Function | DPL Code | Notes |
---|---|---|
List All Pages in a Specific Category | <dpl> category = UBC </dpl> |
This will generate a list for all pages in the category UBC. You can change UBC to any category. |
List All Pages in a Specific Category in Three Columns | <dpl> category = UBC columns = 3 </dpl> |
This will list the pages in three columns. The number of columns can be changed. |
Show all subpages of a particular page | <dpl> titlematch=PAGENAME/% namespace=NAMESPACE shownamespace=false </dpl> |
This code can be added to a specific page with subpages (such as the a top level course page) and it will create a list of all the subpages of that main page. replace PAGENAME with the name of the page (For example: Dynamic Page List) and replace NAMESPACE with the name of the name space(For example: Help) . |
Show only top level subpages of a particular page (but not subpages of subpages) | <dpl> titlematch=PAGENAME/% namespace=NAMESPACE nottitlematch=NAMESPACE/%/% shownamespace=false </dpl> |
This code can be added to a page with subpages (such as the main course page) and it will create a list of the first level of subpages of that main page. Replace PAGENAME with the name of the page (For example: Dynamic Page List) and replace NAMESPACE with the name of the name space(For example: Help) |
Show all articles in a namespace | <dpl> namespace=Course shownamespace=false includesubpages=false </dpl> |
This will generate a list of all pages in the Course space. It will also drop the word "Course:" from the page titles in the list and it will not show subpages. |
I added a new page but it is not showing up in the DPL?
By default, the DPL (after version 1.35) will automatically cache the DPL result for an hour. That is why even if you add a new page on the wiki, the DPL result will not be reflected instantly.
You can remove the cache of the page, and show the most updated result by putting "?action=purge" at the URL of the wiki page you're working on. For example, if you want to remove the cache of https://wiki.ubc.ca/Help:Contents , you will enter https://wiki.ubc.ca/Help:Contents?action=purge ,then press clear cache.
Another option is to add a parameter called allowcachedresults=false.
For example:
<dpl> titlematch=PAGENAME/% namespace=NAMESPACE shownamespace=false allowcachedresults=false </dpl>
This is useful if you have a time where a lot of pages are added to the list in the certain period of time (such as during in-class). We recommend to remove the parameter once it is not needed.
Getting Further
You can view more DPL parameters from: https://web.archive.org/web/20161105221036/http://semeb.com/dpldemo/DPL:Manual. However, please note that some DPL parameters from the documentation may not work.