Grappling the Ins and Outs of Reusable Wiki Content
From StcWiki
Contents |
Overview
Being this wiki serves members of a community that understands the benefits of reusing content, it's no surprise that the idea of using wiki templates has already surfaced as a means of making content development and maintenance easier. However, there's been some confusion about how templates really work. This article aims to iron out the kinks so we not only know how things work, but can more effectively learn to utilize such tools in wiki content handling.
Pieces of the Reusable Puzzle
Wiki templates (MediaWiki templates) alone can be simple to quite complex, but their real potential is gained when used in combination with two MediaWiki extensions: Semantic MediaWiki and Semantic Forms MediaWiki. Let's consider all three puzzle pieces a little more closely to so as to get a big step closer to real wiki content grappling power.
MediaWiki Templates
Since MediaWiki (MW) templates are in fact a feature of MW, and not that other thing called Wikipedia, let's reference the true documentation source, however dismally written it may be, MediaWiki Template Help. It's certainly not the aim here to rehash everything they talk about on that page; in fact, we only need to make one thing clear about MW templates, which is the fundamental basis of MW templates no matter how simple or fancy you try and be with them. MW Templates are pages (which you initially create) having their own namespace special:templates. You create content in a given template page, and then insert that content in one or more wiki locations via a wiki template tag. See help:Understanding and Using Templates for more about using templates.
In this sense, it should be easy to see that templates are great for such things as inserting navigation, common messages, or short inline flags to bring awareness or status to something. A great list of template examples and their explanations of use, is provided in the Mozilla Developer Center's Custom Wiki Templates page. Here are three examples taken from the MDC template list to reflect the three kinds of use just mentioned:
- Inserting navigation (in this case forward/back navigation but it could easily be a custom nav list of some sort: MDC Template:PreviousNext
- Posting common messages: MDC Template:LockedPage
- Inserting short flags (in this example a flag to show something as "obsolete"): MDC Template:obsolete_inline
You cannot edit template output (i.e., where the template content was inserted) because the only thing in edit mode at those locations is the template tag that says "put template X right here". Template content can only be edited in the source template file, which of course will change every instance of that template's output where ever it might be used.
There are advanced ways of using templates by themselves, by incorporating parameters in template content which you then define when calling the template in a given wiki page. Additionally, the ParserFunctions extension can be used to develop templates using various conditional statements. Nevertheless, the basic principle remains: you can not use templates alone to edit custom template output. To do that you need two other powerful extensions.
Semantic MediaWiki
Semantic MediaWiki is best described by it's own creators:
"Semantic MediaWiki introduces some additional markup into the wiki-text which allows users to add "semantic annotations" to the wiki. While this first appears to make things more complex, it can also greatly simplify the structure of the wiki, help users to find more information in less time, and improve the overall quality and consistency of the wiki."
What we are particularly interested in here is the part about semantically annotating wiki content, which in itself is very useful, but its particularly important in this case because to capitalize on the full potential of templates, we need the Semantic Forms MediaWiki, which itself is dependent on the Semantic MediaWiki extension, namely the content annotation aspects.
Semantic Forms MediaWiki
Semantic Forms MediaWiki provides the ability to use forms to add and edit wiki content. It relies on the Semantic MediWiki extension for better annotation of content, but enforces the ability to use templates to piece together content creation/management forms of any possible conception. Ultimately what it means is that content can be created once (as a content form), output in multiple places (via templates), and the output content is then editable without requiring edits to the template source. That's powerful, and cool.
Discussion
I'll be spending some time really reading up on templates, semantic MW, and semantic forms MW to think of ways we can really capitalize on the ability to single-source content with templates, and yet expand on the output content via the use of semantic forms.
If you have any thoughts, please share them in the discussion page.

