【问题标题】:No template definition found for the current content magnolia 5.7.9未找到当前内容 magnolia 5.7.9 的模板定义
【发布时间】:2021-03-18 16:55:35
【问题描述】:

我在 Magnolia 5.7.9 中创建了一个新组件,在 /templates/components 中创建了 placeholder.ftl 和 placeholder.yaml,我可以在模块资源文件下正确看到它们。

placeholder.yaml:

title: Placeholder
renderType: freemarker
templateScript: /xxx-module-versioning/templates/components/placeholder.ftl

placeholder.ftl

<p>Hello World! I'm a Placeholder Component.</p>

这是我以编程方式创建的 JCR 中的组件:

当这个特定组件渲染时,它会给出一个渲染错误:info.magnolia.rendering.engine.RenderException: No template definition found for the current content

原因: info.magnolia.config.registry.Registry$NoSuchDefinitionException: /xxx-module-versioning/templates/components/placeholder.ftl 在 info.magnolia.config.registry.AbstractRegistry.getProvider(AbstractRegistry.java:136) ~[magnolia-configuration-5.7.9.jar:?]

此配置有什么我遗漏或做错了吗?

【问题讨论】:

    标签: magnolia


    【解决方案1】:

    mgnl:template 的值不应该是脚本,而是模板定义,所以类似于xxx-module-versioning:components/placeholder。更多详情请见templating documentation

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-26
      相关资源
      最近更新 更多