ListPages: Automatic Header

Posted by ErichSteinboeck on 25 Mar 2009 15:29, last edited by James Kanjo on 09 May 2010 05:54

Tags: automatic header heading listpages

rating: +7+x

When using module ListPages to select pages by specific criteria, there are two possible outcomes:

  • at least one page matches the criteria (resulting in a list of pages to be displayed), or
  • none of the pages match (resulting in nothing to be displayed)

You'd sometimes want the heading text for the list of pages to automatically adapt to the above situations, e. g. to show a heading text like

  • “Below you'll find a list of pages” if one or more pages are displayed, and
  • “No pages match” if ListPages does not display any pages

Here is a way, how you can do that.


Click on a tag to list Community Blog pages tagged with any tag, listpages, howto, xyzzy

Below you'll find a list of pages tagged with the selected tag

  1. Is wikidot still worth a shot in 2019?: 2019 alive wikidot
  2. A Happy New Year and a cheerful and active life in 2019!: 2019 newyear
  3. For all Wikidot-translators: new phrases seen on languages translate
  4. List pages for current logged in user only: listpages listusers logged-in-user-only
  5. General Data Protection Regulation (GDPR) in EU: datenschutz eu gdpr
  6. Wishes You a blessed and Joyful New Year: 2018 newyear
  7. Bootstrap'd Home Page:
  8. Genealogy Template (new app!) built and published: app genealogy
  9. Bootstrap'd Forum (WIP): bootstrap css forum theme
  10. Talk with us on IRC: community internet multilingual wikidot

This is how the above example was coded:

[[module ListPages tag="@URL" category="blog" limit="10" separate="false"
appendLine="//No pages are tagged with the selected tag//[!----]"]]
//Below you'll find a list of pages tagged with the selected tag//
# %%linked_title%%: %%tags%%

How it Works

Because the "pages available" code is within the ListPages body, it will only display if there are any pages matching the ListPages criteria. Hidden comments are used to ignore the "pages available" message for every page after the first one — the ending [!-- code of the ListPages body is responsible for this. However, when the last page of the matching criteria is displayed, the ending [!-- code will instead hide the "pages unavailable" message.
Note: you must type the shown Wikidot comments ([!----]) and ([!--) exactly as-is. They are required to perform the desired function.

[[module ListPages selection-criteria separate="false"



ErichSteinboeckErichSteinboeck. Please visit his/her userPage.

James KanjoJames Kanjo. Please visit his/her userPage.

Add a New Comment

Related articles


Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.