SMW queries

Here you can see some examples for simple queries using the metadata of a wiki page. You can add these queries to any wiki page.

1. Creating page lists

1.1. Show pages in a particular namespace

{{#ask:
[[:+]]  <!-- find all pages in the main namespace -->
[[Modification date::+]]<!-- necessary to filter deleted pages -->
|format=ul
|limit=4
}}

Output example in list style format:

... further results


Notes:


[[:+]] shows pages from the Main namespace.

[[Myspace:+]] shows pages from the namespace Myspace.

[[:+||Help:+]] shows pages from both the Main namespace and the namespace Help (=OR argument)

1.2. Output in category style

{{#ask:
[[:+]][[Modification date::+]]
|format=category
|limit=12
}}

Output example:

1.3. Show pages from a category

{{#ask: 
[[Category:Administration]] 
| limit=4 
| searchlabel=
| format=ol 
}}
  1. Config manager
  2. Extended statistics
  3. Footer
  4. Main navigation

1.4. Pages that start with the same page name string

{{#ask: 
[[~Visu*]][[:+||Manual:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
| limit=5 
| searchlabel=
| format=ol 
}}

List of pages in the Main namespace and in the namespace Manual that begin with "Visu".


2. Results format: Table

2.1. Format "broadtable"

{{#ask: 
[[~Visu*]][[:+||Manual:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
| limit=5 
| searchlabel=
| format=broadtable
}}



2.2. Format "datatable"

{{#ask: 
[[~Visu*]][[:+||Handbuch:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
| limit=5 
| searchlabel=
| format=table
| class=datatable
}}
Important!The format declaration
|format=datatable 
currently does not work with the BlueSpice skin. Instead, use the following syntax:
|format=table
|class=datatable



Related info




To submit feedback about this documentation, visit our community forum.

Discussions