Fact Lists

From iGeek

It is real common to want to do "Fact Lists": a list of items (facts, examples, etc), that are dynamically built from:

  • subobjects: embedded but not visible in the page
  • atoms: pages/fragments that aren't searchable (any file with the prefix with atom/)
  • articles: that are searchable and self contained article that stand on their own

Basics[edit | edit source]

The way this works is that by embedding Template:Show Facts, with the Category/Categories you want to build the list from, and it will display them in bulleted list format -- and importantly, it allows references to back it up.


Thus: {{Show Facts|Category=Fact}} will show a list a list of items.

Facts[edit source]

  • Factoid #2: Google is a search engine [1]
  • Factoid #1: Apple sells Computers [2]

Adding to the list[edit | edit source]

How does it work?

In order to have something show up in that list, you can create any article, and just add the correct category, that the Show Facts is looking for. So adding: [[Category:Fact]] will allow for Show Fact to find that list item, and it will display anything that was in the 1Liner field, and anything in the Links field.

If you want to embed an article/list item that isn't a whole stand alone article, you can type the following in an article:

{{#subobject:
 |@category=Fact;|+sep=;
 |1Liner=Factoid #1   
}}

And as mentioned if you have something in-between -- that's got enough content to be an article, but you don't really want it searchable. You can prefix and article name with the "Atom/" and that puts it in the Atom namespace, which is hidden from the search tree. So a query won't show it.

{{NOTE|The Template:Show_Facts will work anywhere. Any other article that has that in it, will show the entire list, including the subobjects embedded into another article. This can add confusion if subobects are scattered in separate files -- so try to keep all the subobects in one file, for discovery/editing. But there are cases where one article wants the union of two or more other lists -- and thus subobjects can get scattered).

Code[edit | edit source]

Simple Code Example is the following:

{{#subobject:
 |@category=Fact;|+sep=;
 |1Liner=Factoid #1   
}}
{{#subobject:
 |@category=Fact;|+sep=;
 |1Liner=Factoid #2   
}}
{{#ask: 
 [[Category:Fact]]
 |?1Liner=
}}

My code is a little fancier, since the #ask (query) is done in one template Template:Show_Facts, and it displays each element by running it through another Template:Show_Fact (that formats it pretty).

More[edit | edit source]


  1. Google: Search
  2. Apple: Computers
Cookies help us deliver our services. By using our services, you agree to our use of cookies.