Using Prepr content on a third-party frontend (embed)

You can easily use Prepr content on your own (third-party) frontend with the embed field in models. This kind of embedded codes are a short code, usually in HTML language for users to copy and paste into a website.

Embed field configuration

To create an embed field, go to Settings > Publish > Models and select the model you want to use for content embedding. Select 'Add field' and choose 'Embed HTML'.

Enter the default embed HTML, such as an iFrame code. To add data dynamically from Prepr, you can use variables (embed fields) in your HTML.

Using plain text or HTML encoded variables

By default, you can pre-fill the title and ID of the content item, but you can also choose to add other fields to your embed structure. You can only use API IDs of fields that you have added to your model (title, author, and video in the example above). Each text field will generate a plain text variable as well as an encoded variable.

When using embed codes, it can be necessary to use encoded URLs, so that specific characters are encoded to an HTML structure (f.e.: spaces are encoded into %20 characters). To use an encoded variable, click the .encoded field to add.

Building the embed code

Once you have added the embed HTML to your model, you will see this field in all content items of this model. All variables (API IDs) are replaced in real-time with the data you enter in your content item.

Plain text embed

Encoded embed

Using the embed code

To use the embed code on your frontend or a third-party website, simply click ' Copy code' to save the embed code to your clipboard.