Join the Webstudio community

Updated 2 months ago

Directus CMS - Post integration

At a glance

The community member is testing the data integration from Directus CMS and has two main questions:

1) The post content contains HTML formatting elements like <p> and <h>, and the community member wants to know how to view this content in the correctly formatted "Rich-text" format.

2) Directus returns a unique ID for images instead of a URL string, and the community member wants to know how to convert this to a URL.

The comments suggest using a "content embed component which renders HTML" to display the post content correctly, and that the API should provide a full URL for the images. Another community member provides a specific solution for the image URLs, suggesting to set a variable in Webstudio with the Directus domain and concatenate it with the image ID.

There is no explicitly marked answer in the comments.

I am testing the data integration from Directus CMS.
1) Looking on post, I can access the post content, but within webstudio the text contains typical html format elements, e.g. <p> ... </p> or <h> ... </h> How do I view this in the correctly formated ? Rich-text?
2) For images DirectUs returns a unique id, not an URL string. Is there a way to convert this to an URL?
Thank you in advance.
O
j
a
4 comments
  1. sounds like a case for content embed component which renders html
  1. API must provide a full url
@andyplay do you mean an image in a rich text field or images in general?
for general images, you can set a variable in Webstudio (best on the Global root) that contains "{directus_domain}/assets/". Then on the image url field on webstudio you can bind first this variable and concat the id from the CMS fetch to it.
Thank you, I am going to try this
Add a reply
Sign up and join the conversation on Discord