Wikipedia:GLAM/Museum of New Zealand Te Papa Tongarewa/The whole GLAM package/Make a GLAM Commons template

Add metadata to collection images with a template
When loading images of collections from your GLAM, you should include plenty of metadata. While you can do this with the basic Information template, you can make your own template to share all the relevant information in a user-friendly way.

Before you do, see if existing templates like Artwork, Photograph and Biohist will give you what you need.

A template like this is filled in by providing wikitext-formatted information when you upload an image to the Commons. The wikitext calls the template and then says what information needs to go in what fields, like this:

The first line includes the name of the template, and then each line has a template parameter, which is the how you identify each field, followed by the value to display in that field.

List your fields
Make a list of the fields you want to use by looking at your record data and deciding what's important. Some of the things that really matter are:
 * What the image shows
 * Important people, places, and dates
 * Record identifiers
 * A link back to the record on your website

Each field needs a unique name for the template. The labels your own system might already work, but if not look at the terms used in Dublin Core or Darwin Core.

Table styling
To look like a regular Information template, you need to set up a table within a div that uses certain styles.

At the bottom of the page, include the following to add categories to your template:

Adding fields
Each field is its own segment with a conditional  statement that means it will only trigger if you've provided a value for the relevant parameter. If there is a value, it'll then use the nested  template to render that field and value on the page.

The first line is a comment that doesn't affect the template, but is helpful for quickly seeing which part of the template's code you're looking at.

After the  statement the relevant wikitext parameter, which in this case is , tells the template to see if a that parameter is used in the supplied wikitext.

The nested  template then says what   to show for the field. Here, we're using another mini template called  that lets us include labels in multiple languages.

Finally, it sets this field's  to the value provided in the wikitext.

Add a snippet like this for each field you want to include, making sure the parameter label (eg ) and field name are set correctly in each one.

Documentation
Documentation lives on a subpage below the template itself. Add  to the end of your template url to start that page.

This lets you describe how to use the template, including what fields are available and what kind of information they can have.

One option is to use the TemplateBox template, which lets you describe each field as well as general information about the template itself.

The general information might look like:

Field documentation
For each field, include a snippet like this:

| 1=title
 * 1d-en = Title given to the collection object.
 * 1label = Title
 * 1type = string

Unlike the template itself, you need to add a number for each field, in the order you want them displayed in the documentation. The snippet after  here will need to use ,  , and so on.

See the TemplateBox page for the parameters you can include for each field.

Include the documentation in the template page
Display your documentation below the template by adding just above the categories you put in earlier.