magnolia

No template definition found for the current content magnolia 5.7.9


I created a new component in Magnolia 5.7.9 in that I created a placeholder.ftl and placeholder.yaml in /templates/components and I can see them correctly under module resource files.

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>

Here is the component in JCR that I programmatically create: enter image description here

When this specific component renders it gives a rendering error: info.magnolia.rendering.engine.RenderException: No template definition found for the current content

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

Is there something I am missing or doing wrong with this configuration?


Solution

  • Value of mgnl:template should not be script but the template definition, so something like xxx-module-versioning:components/placeholder. More details can be found in templating documentation.