2017-03-07 99 views
1

我正在用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" %} 

我这么想吗?

在此先感谢。

+0

我刚在你的问题上发布了答案,希望它有帮助。但呃顺便说一句''使用:[标题]''只是'使用:标题' –

回答

0

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

{% setcontent name = "blocks" %}

你应该叫uppon的内容类型。

如果你想测试一下这个还给

{{ dump(test) }}

希望这有助于。

+0

你的解决方案不起作用,结果仍然是空的。 – TheDutchRicolaa

+0

我有一个brainfart。 “名称”是内容的名称。它应该是{{dump(name)}} –

+0

应该返回一些东西。我这次测试了它。 –