How do I build a query that counts pages by category or subcategory?
From semantic-mediawiki.org
Fragment of a discussion from Semantic MediaWiki Community Portal
- Make sure semantics is enabled for category pages,
- define Template:Count pages in category as
{{#ask: [[Category:{{{1}}}]] | format = count}}
, - insert query
{{#ask: [[:Category:+]] [[Category:Parent category]] | link = none | format = template | template = Count pages in category}}
into your page, - submit and wait forever until the page is parsed.