(I'm testing a free cloud Confluence instance at the moment while evaluating documentation systems for replacing my current MediaWiki. Trying to determine what kind of features the platform provides and how I re-implement conveniences that we currently rely on.)
Is there a function in Confluence that can be used like MediaWiki's Template system?
At the most simply level, in MediaWiki you can define a page "Template:Whatever" designed however you wish, with some placeholder text marked up as e.g. {{{{value}}}}. On a different page you can include this template a bit like a Confluence Excerpt but while supplying some text to replace the {{{{value}}}} with, like this:
{{Whatever|value=The text to replace}}
It's very useful for supplying consistent panels of data, for example this simple example from my MediaWiki instance:
{{RAID|mountPoint=/mnt/raid|raidLevel=6|numberOfDrives=11|hotSpares=1|driveCapacity=2 TB|totalCapacity=18 TB}}
This renders as a nice table, contains links to relevant concepts, editing the template causes the display to update wherever it's used etc. The table is inserted into the page in the location of this tag. You can define Categories (similar to Confluence Tags) in the included text to apply to the surrounding page as well. You can get deeply into automatic formatting or processing of the supplied data, but I'm not too worried about that bit for now.
Excerpts do a similar transclusion thing, but only for fixed data. Confluence Templates are more for initial page states.
Can anyone point me in the right direction for implementing this kind of thing in Confluence please?
EDIT: I am looking into custom Macros as they look promising, if a bit fiddly. If anyone knows whether I'm on the right track, please let me know!
The Inclusion library approach using the Include Page macro might work better for this use case than the Excerpt Include macro.
You would be able to modify the element in just one place and have the changes reflected across all pages reusing that content.
This approach doesn't really simply content formatting, but that doesn't seem to be a need you have.
Hi Matt,
Thank you for the response.
The Include Page macro looks like it works with static information so doesn't really fit my use-case. Yes, I'd want to be presenting a similar block of data in multiple places, but each time would be supplying some parameters or data that will change the content or the way in which it is rendered.
To present a specific example, please see the Wikipedia page for Arnold Schwarzenegger: https://en.wikipedia.org/wiki/Arnold_Schwarzenegger
In the source you'll see for example a tag starting like this:
{{Infobox officeholder
| name = Arnold Schwarzenegger
| image = Arnold Schwarzenegger by Gage Skidmore 4.jpg
The page for Otto von Bismarck: https://en.wikipedia.org/wiki/Otto_von_Bismarck similarly contains:
{{Infobox officeholder
|honorific_prefix = [[His Serene Highness]]
|name = The Prince of Bismarck
|image = Bundesarchiv Bild 146-2005-0057, Otto von Bismarck.jpg
So the "Infobox officeholder" template is used on both pages to present a standard look-and-feel and similar set of data and behaviour to display for these two people, and the data is supplied from the including page.
I hope that clarifies the function of a MediaWiki template and my question!
Regards,
Charlie.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.