# typemap

## Value

An Object containing one or more properties named after the Zotero item types.

Each property should be defined as follows :

* **Name** : the property name has to follow the Zotero data scheme. An old nomenclature of item types is available [here](https://aurimasv.github.io/z2csl/typeMap.xml).
* **Value** : the property's value should be a string, corresponding to the name of the Roam tag/page to use to categorize the type of the item.

For example, defining `typemap.bookSection`  with the value `'Chapter'` will have the extension create a block `Type:: [[Chapter]]` instead of `Type:: [[Book Section]]` for items of type `bookSection`.

## Usage in the extension

The utility function `zoteroRoam.formatting.getItemType` function (which is called in [getItemMetadata](https://alix-lahuec.gitbook.io/zotero-roam/v0.5/extension-defaults#getitemmetadata)) looks for an item type's label in `zoteroRoam_settings.typemap` (if it exists), otherwise it falls back on the extension's default typemap object (`zoteroRoam.typemap`).

{% hint style="info" %}
If you've defined your own formatting functions, and never use `getItemMetadata`, then you probably don't need `typemap` - unless you're using [zoteroRoam.formatting.getItemType](https://alix-lahuec.gitbook.io/zotero-roam/v0.5/formatting/code-snippets#data-itemtype) in your own functions.
{% endhint %}

## Examples

:pencil2: *Assigning custom labels for a few item types :*

```javascript
// Other item types will be associated with their label from zoteroRoam.typemap

zoteroRoam_settings = {
    // dataRequests: {...},
    typemap: {
        bookSection: 'Chapter',
        conferencePaper: 'Paper',
        journalArticle: 'Paper'
    }
}
```
