(This part was written first, but the conclusion/outline seemed more valuable than this background thought) I realized why I'm struggling to come up with good ideas for this one: I only really know much about MW's system.
So, did a bit of research into how it's done on other software. They mostly do similar things, and all major wiki software includes some form of templating, but many have different takes on the core idea (e.g. Cofluence is clearly optimized for non-technical users).
- Some wikis have non-global templates.
- This seems mostly bad. It would allow short domain specific templates, but having the same text display differently seems like a much worse problem
- However, it does bring up the question of how to handle templates between subdomains. Probably allow templates from the main arbital repository to be called from private groups, with slightly different syntax (a ! at the start of the name or something)?
- Templates are generally stored separately from pages, but often use the same edit interface.
- Most wikis allow multiple layers of transclusion.
- This can be very useful for maintaining consistency and ease of template creation, but can also lead to unreadable mazes with 8 layers of template which are inefficient to unpack every time a page is served (MW gets around this through extensive caching).
- There are several different attempts to make templates more user friendly. The main approach is having a flexible form which allows you to input variables, rather than doing it directly as text.
- The variables are usually stored in page text, but they could be stored separately.
- In text has the advantage of being editable from the normal edit window, but the disadvantage of having a lot of scary visual clutter at the top of edit windows (a lot of users would get put off by this, for example).
- Separately has the advantage of having structured information stored in a form which invites complex searching and analysis, and would work by having templates show up differently in the edit window, with the option to click on them to edit their variables via popup form.
- I suspect separate storage is significantly better, but requires extra UI work. Wikimedia's use of Wikidata rather than adoption of SMW and their creation of the TemplateData extension both feel like attempts at approximating the advantages of it, patching over a bad design decision which got baked in.
Some other links: