【问题标题】:Get content from a block从块中获取内容
【发布时间】:2017-03-07 19:00:41
【问题描述】:

我目前正在构建一个使用 Bolt 作为 CMS 的网站。但是现在我正在努力将内容从一个块中取出。我的 contenttypes.yml:

blocks:
    name: Blocks
    singular_name: Block
    fields:
        title:
            type: text
            class: large
            group: "Block"
        slug:
            type: slug
            uses: [ title ]
        text-one:
            type: text
            label: Tekst 1
            group: content
        text-two:
            type: text
            label: Tekst 2
            group: content
        text-three:
            type: text
            label: Tekst 3
            group: content
        text-four:
            type: text
            label: Tekst 4
            group: content
        text-five:
            type: text
            label: Tekst 5
            group: content
        text-six:
            type: text
            label: Tekst 6
            group: content

我的树枝代码:

{% setcontent block_cta = "block/cta-nl" %}

我错过了什么吗?

提前致谢。

【问题讨论】:

  • 我刚刚就您的问题发布了答案,希望对您有所帮助。但是顺便说一句`使用:[标题]`应该只是`使用:标题`

标签: bolt-cms


【解决方案1】:

你好,你做的有点不对。如果你想从内容类型中获取值,你应该试试这个

{% setcontent name = "blocks" %}

您应该调用内容类型。

如果你想测试这会返回什么:{{ dump(test) }}

希望这会有所帮助。

【讨论】:

  • 你的解决方案不起作用,结果还是空的。
  • 我脑残了。 “名称”是内容的名称。它应该是 {{ dump(name) }}
  • 应该返回一些东西。这次我测试了。
猜你喜欢
  • 1970-01-01
  • 2015-09-14
  • 2019-08-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-07-03
  • 1970-01-01
相关资源
最近更新 更多