Jump to content

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

From Wikipedia, the free encyclopedia

Add metadata to collection images with a template[edit]

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:

{{TePapaColl
|basisOfRecord=Herbarium sheet
|qualifiedName=Myosotis tenericaulis Petrie
|genusVernacularName=Forget-me-not
}}

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.

Making a new template[edit]

List your fields[edit]

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[edit]

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

<div class="hproduct commons-file-information-table">
    <table class="fileinfotpl-type-information toccolours vevent mw-content-{{Dir|{{int:lang}}}}" style="width: 100%; direction: {{Dir|{{int:lang}}}};" cellpadding="4">

**your template fields will go in here**

    </table>
</div>

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

<noinclude>
[[Category:Data ingestion layout templates]]
</noinclude>

Adding fields[edit]

Each field is its own segment with a conditional if 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 Information field template to render that field and value on the page.

<!-- TITLE -->
{{#if:{{{title|<noinclude>1</noinclude>}}}|
   {{Information field|name={{LangSwitch|en=Title|}}|value={{{title|}}} }} 
}}

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 if statement the relevant wikitext parameter, which in this case is title, tells the template to see if a that parameter is used in the supplied wikitext.

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

Finally, it sets this field's value 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 title) and field name are set correctly in each one.

Documentation[edit]

Documentation lives on a subpage below the template itself. Add /doc 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:

{{TemplateBox
|useTemplateData=1
|name=TePapaColl
|desc={{tl|TePapaColl}} is an in-development template to support the loading of images from Museum of New Zealand Te Papa Tongarewa.

It uses a subset of fields for both natural history specimens and humanities objects. Where possible, fieldnames align with Darwin Core, Dublin Core, and/or the Te Papa API.

Te Papa is using this template alongside OpenRefine to load both descriptive and structured metadata alongside collection images.

Related templates are {{tl|Specimen}} and {{tl|Biohist}}.
|desc-td-en       = This template is used to provide formatting to descriptive metadata associated with images of museum objects held by Te Papa.
|namespace=file
|usergroup=all
|seealso=[[Commons:Infoboxes]], {{tl|Specimen}}, {{tl|Biohist}}
|placement          = top
|example-value      =
|mustbesubst        =
|relieson           =
|usage-notes        =
|shorthand          =
|setscats           =
|type               = infobox 
|i18n-desc          =
|i18n-subpage       =
|i18n-mediawiki-msg =
|i18n-method        =
|example            =
|print              = infobox

** your fields can then be added here **

}}

Field documentation[edit]

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 title here will need to use 2=, 2d-en=, and so on.

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

Include the documentation in the template page[edit]

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

{{documentation}}
<noinclude>
[[Category:Data ingestion layout templates]]
</noinclude>