0

I can upload an image, then on its File page I can transclude a Cargo-enabled template that stores some metadata about that image, and later query that template's table in order to create a gallery. However, the manual addition of the template to the File page is tedious and error-prone (e.g. incorrectly naming other pages in various template fields). Is there an extension, perhaps something like Page Forms, that would allow me to simplify this process, so that I could upload an image and populate its metadata on a single page? Is there any simpler workflow in base MediaWiki to achieve this result?

Sparr
  • 7,489
  • 31
  • 48

1 Answers1

0

I'm not familiar with Page Form based solution, What i've done in a similar case (added a templates to 3 sets of ~1k pages) is to use pywikibot (its a library that allows you to do some automated processes in your mediawiki, that an external tool).

The solution is depend on your template, Does your template receive any arguments?

  1. Template without arguments, its enough just to add "{{My_Template}}" to the page, You can achieve this with pywikibot's add text.py script
  2. Template with arguments, that more complicated, In this case i would write a simple python script that will use pywikibot and add the required text (There are several options here)

    2.1. Add of relevant files to category with category script, Then in your script iterate over all pages in the category using:

    "from pywikibot import pagegenerators" and "pagegenerators.CategorizedPageGenerator"

    2.2. Using: "pagegenerators.SearchPageGenerator" and passing a namespace + filtering the files you want by predefine knowledge.

BTW, if you are uploading many files, you can use BatchUpload

Kosho-b
  • 161
  • 5