I have a MediaWiki question!
I frequently find myself needing to do the following:
a)Add a page to Category X, where X is dependent on a parameter
b)Add Category X to Category Y, where Y is dependent on the same parameter as part (a)
c)Add Category X to Category Z, which is not dependent on a parameter.
I can automate the first step using a simple template that contains [[Category:Something with my parameter]]
, but I want help automating the next two steps.
I realize I'm maybe being a bit vague, so let me clarify with a concrete example (the example that inspired this question).
When @comicsbyxan published Chapter 11 of Pandora's Tale, I made the corresponding wiki article. The chapter was the first appearance of new character Amelia, so I wanted to
* List in the chapter article that it was the first appearance of Amelia.
* Include the chapter article in Category:Amelia appearances
* Include Category:Amelia appearances
in Category:Amelia
* Include Category:Amelia appearances
in Category:Chapters by character appearances
The first two bullet points I can do simultaneously, thanks to the simple "appearances" template.. I just add
{a|Amelia}
To the article on Chapter 11. But I have to do the third and fourth bullet point manually. While that's not a big deal to do once, I have to do it for every new character Xan adds to the comic. Chapter 10
introduced nine new characters at once, so I had to do it nine times.
Is there a way to soup up my {a} template so that when I type, for example, {a|Example New Character}
, it automatically creates a page for
Category:Example New Character appearances
and includes it in both
Category:Example New Character
and
Category:Chapters by character appearances
? Is this the kind of thing I should to learn Lua Modules for or is there a way to do it purely with wiki markup?
The hard part seems to be that I want to invoke a template in one article and have it modify a different page. I haven't found any wiki functions that can do that.
UPDATE 2
I fixed it!
Here's the code that makes it work[[{{{1}}}]][[Category:{{{1}}} appearances]]{{#if:{{{new|}}}|{{#createpageifnotex:
Category:{{{1}}} appearances
|<nowiki>[[Category:</nowiki>{{{1}}}<nowiki>]][[Category:Chapters by character appearances]]</nowiki>
}}|}}
#MediaWiki #Wiki #Miraheze #Wikis #TechHelp #TechQuestions #PandorasTale #PandorasTaleWiki #Lua #Scribunto
RE: https://transfem.social/notes/a12wxwqpigwk00vv