Topic on Project:Support desk

How do I reuse MediaWiki templates between wikis?

3
195.234.74.168 (talkcontribs)

Hello.

While editiing my wikis a lot I noticed that I would like to create a sort of a library out of the templates that are used on all of those wikis (especially the ones that put metadata onto pages in Semantic MediaWiki). This question may be too broad, but what are the best practices of sharing MediaWiki markup between wikis? Would it be possible to make it in "library fashion" somehow so I could put the templates in a certain repository? Another point of such an approach, I think, might be just sharing the templates world-wide, let's say, on GitHub/BitBucket/etc.

Any advices and answers are greatly appreciated! Thank you in advance!

Cavila (talkcontribs)

Of course, templates can be complex, site-specific creatures with dependencies on many other templates, extensions, semantic data, etc., which then also need to be transcluded or enabled on your wiki - simply borrowing a template would not always work out of the box. I think you would need to come up with your own way of managing the templates that you need for your wikis. If you are using SMW, you could use that to store data about their usage and create some sort of a library.

See also: Manual:$wgEnableScaryTranscluding (but the above comment also applies here).

195.234.74.168 (talkcontribs)

Hi Cavila, and thank you for the reply. I usually design (if this word applies here well) decoupled templates as much as possible. It brings some complexity and templates amount bloat, but the very main "core" templates are perfect candidates to be reused or demonstrate MediaWiki markup or template techiniques. I thought it might be something like a syncing bridge between a VCS and MediaWiki (have no real idea how it would work though). A few years ago I asked if MediaWiki supports a VCS-integration, but it was never implemented. Another option I thought about was git-remote-mediawiki helper use, but I don't find the latter a reliable solution ignoring non-main namespaces like `Template:` or extremely hard way to rebase the commits in order to put a single file change into a single commit (but it really helped me *very much* to restore a really big part once my wiki crashed and lost its database, though). Anyway thank you very much for the suggestions!

Reply to "How do I reuse MediaWiki templates between wikis?"