# Generic Properties

## Overview

![Selected Generic Properties for a teaser](/files/-LtdBRfQqPo-CImi5d1h)

Sometimes a customer specific problem occurs where the solution could be to add a simple select box with preconfigured values to a content object, i.e. image, PDF, content part, or HTML Embed. For instance, maybe a specific image in the article should be used as the featured image, or a specific image should be inlined in the presentation layer, or maybe the Image Gallery needs a value specifying if it should appear at the top of the article or bottom.

These kinds of problems could all be solved using Generic Properties, and some configuration examples exists here for common problems.

### Configuration

For a more indepth configuration guide and examples, see [Configuration page](/writer/admin-guide/generic-properties/generic-properties-configuration.md).

A Generic Property only needs to be defined once, and could then be used by many different plugins. For instance, a property called "Position" could be used by both the image plugin and image gallery.

Configuration for this example would look like this:

```javascript
{
    "propertiesConfig": {
        "properties": [
            {
                "name": "position",
                "title": "Position",
                "plugins": [
                    "im-imagegallery",
                    "im-ximimage"
                ],
                "values": [
                    {
                        "title": "Top",
                        "value": "top"
                    },
                    {
                        "title": "Bottom",
                        "value": "bottom"
                    }
                ]
            }
        ]
    },
    "plugins": ...
}
```

So instead of having to define a "Position"-property for both image gallery and image, it is defined once, and used by both plugins.

It's important to distinguish this from actual presentation, generic properties are only stored in the article XML as a string for you to handle on each presentation layer, the Writer only displays the selection.

### XML Output

Below is an example output from the above configuration when used on an image and the user has selected the value `"top"` for the generic property Position.:

```markup
<object id="MTI1LDIyNiw3OSw5OQ" type="x-im/image" uuid="5f720706-0f79-531c-be69-55dcb574a90b">
    <links>
        <link rel="self" type="x-im/image" uri="im://image/XabjbUPYd8tv-myp4VW4STU--XM.jpg" uuid="5f720706-0f79-531c-be69-55dcb574a90b">
            <data>
                <width>2048</width>
                <height>1360</height>
                <imageInstructions/>
                <text/>
                <credit/>
            </data>
        </link>
    </links>
    <properties>
        <property name="position" value="top"/>
    </properties>
</object>
```

As seen, the element `<property name="position" value="top"/>` has been added, where the `name`-attribute gets its value from the `name`-property in the configuration and the `value`-attribute gets its value from the selected option's `value`-property in the configuration

When there are no properties selected, the `<properties>`-element will simply not exist in the XML:

```markup
<object id="MTI1LDIyNiw3OSw5OQ" type="x-im/image" uuid="5f720706-0f79-531c-be69-55dcb574a90b">
    <links>
        <link rel="self" type="x-im/image" uri="im://image/XabjbUPYd8tv-myp4VW4STU--XM.jpg" uuid="5f720706-0f79-531c-be69-55dcb574a90b">
            <data>
                <width>2048</width>
                <height>1360</height>
                <imageInstructions/>
                <text/>
                <credit/>
            </data>
        </link>
    </links>
</object>
```

### Limitations

In order to make Generic Properties so dynamic there are some limitations:

* The only supported input is a dropdown, no free text input
* Only strings (text) are allowed as values
* No support for default values if no option is selected
* No support for adding Generic Properties to specific "types" for plugins that have "types"-support, i.e. Teaser and Content Part

### Supported Plugins

Below is a (hopefully) current list of Naviga developed plugins with Generic Properties support.

| Plugin                                                                                                | Plugin Name (to be used in configuration) |
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------- |
| [Content Part](https://plugins.writer.infomaker.io/v1/infomaker/im-contentpart/latest/README.html)    | `"im-contentpart"`                        |
| [HTML Embed](https://plugins.writer.infomaker.io/v1/infomaker/im-htmlembed/latest/README.html)        | `"im-htmlembed"`                          |
| [iFramely Embed](https://plugins.writer.infomaker.io/v1/infomaker/im-iframely/latest/README.html)     | `"im-iframely"`                           |
| [Image Gallery](https://plugins.writer.infomaker.io/v1/infomaker/im-imagegallery/latest/README.html)  | `"im-imagegallery"`                       |
| [Map Embed](https://plugins.writer.infomaker.io/v1/infomaker/im-mapembed/latest/README.html)          | `"im-mapembed"`                           |
| [PDF Upload](https://plugins.writer.infomaker.io/v1/infomaker/im-pdf/latest/README.html)              | `"im-pdf"`                                |
| [Social Embed](https://plugins.writer.infomaker.io/v1/infomaker/im-socialembed/latest/README.html)    | `"im-socialembed"`                        |
| [Table Plugin](https://plugins.writer.infomaker.io/v1/infomaker/im-table/latest/README.html)          | `"im-table"`                              |
| [Teaser](https://plugins.writer.infomaker.io/v1/infomaker/im-teaser/latest/README.html)               | `"im-teaser"`                             |
| [Image Presentation](https://plugins.writer.infomaker.io/v1/infomaker/im-ximimage/latest/README.html) | `"im-ximimage"`                           |
| [YouTube Embed](https://plugins.writer.infomaker.io/v1/infomaker/im-youtubeembed/latest/README.html)  | `"im-youtubeembed"`                       |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.navigaglobal.com/writer/admin-guide/generic-properties.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
