mediawikimediawiki-templates

mediawiki: Assign a unique reference to each article using categories


I want to create a unique reference in each article. This is done by using catgories with the following template, which extends the PageID with a thematic prefix.

{{Category:{{{1}}}{{PAGEID}}}}

I have integrated it into the article like this

{{{ReferenceID|Item}}}

The text of the template is displayed correctly, but Mediawiki does not recognize it as a category and it is not displayed on the special page "desired categories".

What is the mistake? May there is an other option


Solution

  • The syntax of assigning categories to pages is [[Category:{{{1}}}{{PAGEID}}]], not {{Category:{{{1}}}{{PAGEID}}}}.

    The wikicode {{{ReferenceID|Item}}} is meaningful only in a template that has a ReferenceID parametre. The template above, which adds category, hasn't.

    If ReferenceID is the name of the template above, it is inserted like this: {{ReferenceID|Item}}, not {{{ReferenceID|Item}}}.

    The very idea of creating a category for each page is strange. If you want each page to be accessible by a unique ID, create a redirect like #redirect [[(full page name)]] under the title (theme prefix)/(page id). You may want to store those redirects in a separate namespace.