Outputting a theme setting without stripping the html

Hello folks,

I am trying to output a theme setting in my theme, and this setting contains some html. Anyhow, the following is not working:

{{html-safe (theme-setting "my_text")}}

What am I doing wrong?

Thanks.

1 Like

Hello :wave:
I made a theme component on which it works.

Excerpt of settings.yml:

content_before:
  default: "<strong>Donation progress bar</strong>"
  type: string
content_after:
  default: "<em>The progress bar will disappear as soon as the donation goal is met.</em>"
  type: string

Excerpt of head_tag.html:

<div class="progress-bar-before">{{html-safe (theme-setting "content_before")}}</div>
    <div class="progress-bar-data">
        <div class="progress-bar-container">
            <div class="progress-bar"></div>
        </div>
        <div class="progress-status"></div>
    </div>
<div class="progress-bar-before">{{html-safe (theme-setting "content_after")}}</div>

Result:

image

Maybe you’ll find some clue with this?

Or can you share a bit more of your theme component code?

2 Likes

Thank you so much! I will try to figure out what I am doing wrong!

1 Like