Hey, I am building a CMS at the moment. Workflow is like this: An Admin is able to create a new page so he fills out a form. The body field of this form can contain either components we have in our system or plain text. The text and component fields are saved in the database as components of this page.
At the moment, when reading from the db, the components are displayed as text. What do i have to do to resolve
the text to the actual component.
The page.ex file, where i retrieve the specific page and display it. It’s a live_view. I am calling component.content here because that is where my components/text is stored in.
@impl true
def render(assigns) do
~H"""
<div class="">
<.header>Page</.header>
<%= for component <- @page.components do %>
<%= (render_component here ? )component.content %>
<% end %>
</div>
"""
end
As a result, I get this <.faqcontainer> test <.faqcontainer> printed on my page.
I want the contents
from the two faqcontainer’s instead. Basically i want to display the components, not their names.
Thanks a lot