在“content/static-pages/index.htm”上,我可以看到可以在页面上呈现的已保存字段:
然后在局部我可以使用 {{ data.section_color }} 来呈现一个字段。
现在我想在“meta/groups.yaml”中创建一个转发器字段,如下所示:
carousel2:
name: Carousel2
description: Carousel2
icon: icon-file-image-o
fields:
section_carousel2:
type: repeater
prompt: Add new subitem
form:
fields:
section_carouselimage2:
label: Image2
type: mediafinder
mode: image
section_carouseltitle2:
label: Title2
type: text
section_carouselsubtitle2:
label: Subtitle2
type: textarea
size: small
我可以在后端看到该字段,并且可以使用它保存数据。在“content/static-pages/index.htm”现在我有:
[viewBag]
title = "Home"
url = "/"
layout = "static"
is_hidden = 0
navigation_hidden = 0
sections[0][section_carousel2][1][section_carouselimage2] = "/carousel/bg-1.jpg"
sections[0][section_carousel2][1][section_carouseltitle2] = "Carousel2 Title"
sections[0][section_carousel2][1][section_carouselsubtitle2] = "Carousel2 Subitle"
sections[0][section_carousel2][2][section_carouselimage2] = "/carousel/bg-2.jpg"
sections[0][section_carousel2][2][section_carouseltitle2] = "Carousel2 Title2"
sections[0][section_carousel2][2][section_carouselsubtitle2] = "Carousel2 Subtitle2"
sections[0][_group] = "carousel2"
==
问题是我找不到渲染这个字段的方法。如何在转发器组内呈现转发器字段?我如何渲染例如“section_title2”字段?