Spring boot Groovy模板引擎呈现内容

Spring boot Groovy模板引擎呈现内容,spring-boot,Spring Boot,我正在尝试分离layout.tpl的body部分中的一些内容。例如,我在index.tpl中有carousel slider,但没有必要将其包含在login.tpl中。此外,我还需要添加另一页特定的内容。因此,layout.tpl和index.tpl如下所示: layout.tpl body { headerContents() div(class:'container') { div(class:'row') { div(class:

我正在尝试分离layout.tpl的body部分中的一些内容。例如,我在index.tpl中有carousel slider,但没有必要将其包含在login.tpl中。此外,我还需要添加另一页特定的内容。因此,layout.tpl和index.tpl如下所示:

layout.tpl

  body {
    headerContents()
    div(class:'container') {
        div(class:'row') {
            div(class:'col-lg-12') {
                content()
            }
        }
    }
  }
layout 'layouts/layout.tpl',
title:'Home',
headerContents: contents {
   h1('Test Header')
}
content: contents {
   h1('Test Content')
}
index.tpl

  body {
    headerContents()
    div(class:'container') {
        div(class:'row') {
            div(class:'col-lg-12') {
                content()
            }
        }
    }
  }
layout 'layouts/layout.tpl',
title:'Home',
headerContents: contents {
   h1('Test Header')
}
content: contents {
   h1('Test Content')
}
但是不能呈现
h1('测试内容)
。我检查了文档,但找不到关于如何呈现两个不同内容的任何信息。模板引擎是否支持这样做