Kontent.ai
Copyright © 2023 Kontent.ai. All rights reserved.
  • Web
  • Privacy policy
  • Cookies policy
  • Consent settings
  • Security
  • GDPR
  • Documentation
  • API reference
  • Product updates
Kontent.ai Learn
  • Plan
  • Set up
  • Model
  • Develop
  • Create

Embed content through components

Is this page helpful?
  • Sign in
  • Martina Farkasova
    6 minutes
    Components
    Supercharge your content beyond just text and images. Use linked content items and embedded components to seamlessly integrate external content into your rich text.Discover how to embed diverse content like tweets, videos, code snippets, or customer testimonials. Enhance your content, engage your audience!

    Insert tweets or code samples into content

    Embedding content inside rich text is a matter of defining the structure for your content and then providing specific content based on that structure. See how it all works on the example of tweets inside articles.

    Create a content type for the tweet

    The first step is to create a content type that will define the basic elements of the tweet.
    1. In Content model, click Create new.
    2. Type Tweet in Content type name.
    3. Add a Text element for the tweet link.
      1. Name it Link.
      2. Make it required.
    4. Click  Add a new content group.
      1. Name it Display options.
      2. Click Add content group.
    5. Add a Multiple choice element for the options.
      1. Add two options named Hide thread and Hide media.
      2. Set the element to show as Checkboxes.
    6. (Optional) Add another Multiple choice element for selecting a theme.
      1. Add two options named Dark and Light.
      2. Set the element to show as Radio buttons.
    7. Click Save changes.
    The finished Tweet content type can look similar to what you see below.

    Insert a tweet

    Once you have the tweet defined, you can insert it as a component in a rich text element of an article, for example.
    1. Go to Content & assets.
    2. Using the filters on the left, select the Article content type to view only articles.
    3. Open an article for editing.
    4. In a rich text element, place the cursor where you want to add the tweet.
    5. In the editor toolbar, click Insert... and then Insert new component.
    6. Choose Tweet from the list of types.
    7. Fill in the elements. 
    You now have a tweet that exists only within the article as a component.
    After you finish, you can continue editing the article. Changes made to the tweet are saved automatically.
    This is what the final result can look like in your app:
    Tweet added to rich text as a component.
    A tweet embedded in the article on a website.
    • Docs
    • Collections
    • Custom elements
    • Environments
    • Keyboard shortcuts
    • Projects
    • Spaces
    • Task management
    • Terminology
    • Web Spotlight
    • Create and delete content items
    • Comments and suggestions
    • Editorial calendar
    • Embed content through components
    • Find and filter
    • Linking
    • Project overview
    • Relations
    • Rich text
    • Tagging
    • Versioning
    Other use casesThe principle is the same for other types of content. If you were to embed code samples, for instance, you would add a text element for the code itself and an option to select a programming language to enable proper language-specific syntax highlighting.
    From single-use to re-useIf you later find another use for the content in your component, you can always convert it to a content item by clicking Reuse as content item. This conversion cannot be undone. If done by accident, archive the new item and create your component again.
  • Insert tweets or code samples into content