输出主题设置而不剥离html

大家好,

我正在尝试输出主题中的一个主题设置,该设置包含一些 HTML。无论如何,以下内容不起作用:

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

我哪里做错了?

谢谢。

1 个赞

你好 :wave:
我做了一个主题组件,它能正常工作。

settings.yml 的摘录:

content_before:
  default: "<strong>捐赠进度条</strong>"
  type: string
content_after:
  default: "<em>一旦达到捐赠目标,进度条就会消失。</em>"
  type: string

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>

结果:

image

也许你能从中找到一些线索?

或者你能分享更多你的主题组件代码吗?

2 个赞

非常感谢!我会努力找出我哪里做错了!

1 个赞