Skip navigation

Using assets in the content model

When you have lots of assets in Kentico Kontent, file organization becomes a must. And not only that. You may want to also manage asset metadata to specify their display options and replace them whenever necessary. See how to do it all by adding a simple content type.

Table of contents

    This guide will use the example of images where you might want to add custom display options for the image, a category to find the images you're looking for, a license for the image's use, and who created the image. You could easily apply similar principles for other kinds of assets (e-books, videos, etc.) or just have a single type for all assets to manage them together.

    Create an Image content type

    To be able to add extra information to your images, start by creating a content type to hold them. This assumes you've already created a taxonomy to categorize the images. You may also have created an Attribution content type to hold information about who created the image, similarly to linking authors to articles.

    1. From the app menu, choose  Content model.
    2. Create a new content type and name it Image.
    3. Add an Asset element and name it Image – this is where images themselves will be uploaded.
      1. Limit it to exactly one asset.
      2. Make it required.
    4. Add a Rich text element and name it Caption.
    5. Add a Multiple choice element and name it Width.
      1. Add options for different image widths.
    6. Add a Multiple choice element and name it License.
      1. Add options for different licenses.
    7. Add a Linked items element and name it Attribution.
      1. (Optional) Limit it to the Attribution content type.
    8. Add a Taxonomy element and select your created taxonomy group for image categories.
    9. Click Save changes.

    Group the elements for easier access

    When working with your images, your content creators might first want to see the elements that they will use the most. Use content groups to group similar elements together and name them.

    For example, you can put Image and Caption in a group named Content, Width in a group named Display options, and Licenses and Attribution in a group named Metadata.

    Image content type with element guidelines

    Image content type with its elements separated in groups.

    Now that you have a content type set up, you can add new images to hold and manage your content.

    Add images to content

    You can add your images as either single-use components directly inside rich text elements or as reusable linked items.

    Should you use components or linked items?

    Linked items might be more useful than components if you need to find the items by taxonomy term, for example. You can't do so with components so your categorization wouldn't work.

    Though if categorization is not a must, using components will give you similar benefits and they will instantly become an integral part of your content. See ways to structure your content to find the best fit for your use case.

    Single-use images as your default

    Whenever you need to insert the image only in one spot, we recommend you start with single-use components.

    1. In Content & assets, open the content item where you want to place the image.
    2. Find the rich text element you wish to use.
    3. Inside the element, click and then .
    4. In the list of types, select Image.
    5. Fill in the elements.

    Adding an image to your content in one place

    Your image component including all of its associated information is now a part of the content item, sharing the item's workflow and lifecycle.

    From single-use to re-use

    If you later find another use for the content in your component, you can always convert it to a content item by clicking . This conversion cannot be undone. If done by accident, you can archive the new item and recreate your component.

    Reuse images when needed

    If you know from the beginning that you want to use your image in multiple places, create a content item. 

    1. In Content & assets, click Create new.
    2. If collections are available to you, select one for the new content item.
    3. Choose Image as the content type.
    4. Type a name in Content Item Name.
    5. Upload an asset and fill in the other elements as needed.

    When you have your image items ready, you can add them to your content in two ways – either in linked items elements (to replace the use of Asset elements) or inside rich text as linked items.

    To add such an image to a content item:

    1. In Content & assets, open the content item where you want to add the image.
    2. Find the linked items element or rich text element you wish to use.
      • For a linked items element, choose Add existing items.
      • For a rich text element, click inside the element, click and then .
    3. Select your Image item from the list.

    Adding a reusable image to your content in more places.

    Replace reused assets

    When you have your assets inside content items, replacing them across your entire project is simple. Instead of needing to go to every content item an asset is used in and replacing it manually, you only need to replace it in one content item and it will be updated everywhere.

    To replace one image with another:

    1. In Content & assets, enter the name of the image item in the filter at the top.
    2. Open the filtered out content item.
    3. (If your item is published) Click Create a new version at the top.
    4. Remove the current image and add a new one.
    5. (Optional) Click Publish… at the top of the page.

    Now your asset will be automatically replaced wherever it is used (you can see where under Used in in the right sidebar).

    Manage assets in multilingual projects

    If you're using content items to hold your assets and adding them as linked items, it's important for you to understand how language fallbacks work. If you add an Image content item as a linked item in one language (for example, English), it will not appear in any other language (for example, Spanish) unless you translate it into that language. Even if the information you're including in your Image content item is not language-dependent (e.g., it's just the creator's name), you need to create a variant in every language to have it appear. Copying content from the original language can give you a head start.

    What's next?

    You've seen how to create a content type to hold your assets and then add content items based on this type to your content. You can store any information you want in these items, including taxonomies for categorization and any other metadata you want to be associated with the asset. You can also replace your asset in one place and have it updated across your site.