简体   繁体   English

如何将自定义 java 模块添加到 magnolia CMS 中?

[英]How to add a custom java module into magnolia CMS?

I have created a minimal web app with maven following the tutorial我按照教程创建了一个使用 maven 的最小 Web 应用程序

I want to add my own Java components into the webapp.我想将自己的 Java 组件添加到 webapp 中。 I found these guides: guide1 and guide2我找到了这些指南: guide1guide2

But I still cannot make a page in Pages App using templates from links above (just do not have that templates)但我仍然无法使用上面链接中的模板在 Pages App 中创建页面(只是没有那个模板)

What am I doing wrong?我究竟做错了什么? Should I try smth else?我应该试试别的吗? Thanks.谢谢。

There are 2 types of templates that Magnolia supports if you want to use it to render content as well as supply it.如果您想使用 Magnolia 来呈现内容并提供内容,Magnolia 支持 2 种类型的模板。 There is a page template that is associated with over page and then there is a component template that is used to render components within the page.有一个页面模板与页面关联,然后有一个组件模板用于在页面内呈现组件。 Each page can have only one page template associated with them while it can contain multiple components of different type and multiple instances of those components as well.每个页面只能有一个与之关联的页面模板,而它可以包含多个不同类型的组件以及这些组件的多个实例。

From what I can see, your first guide will only create structure for templates in the generated module, but not actual templates.据我所知,您的第一个指南只会为生成的模块中的模板创建结构,而不是实际的模板。 And your second guide will only create templating function and component template to demonstrate that function, but not a page template.您的第二个指南将仅创建模板功能和组件模板来演示该功能,而不是页面模板。

So first, you should check that in your module structure, somewhere under /src/main/resources/<your module name>/templates you have subfolder called pages and in that folder you have defined page template.所以首先,你应该检查你的模块结构,在/src/main/resources/<your module name>/templates下的某个地方,你有一个名为pages的子文件夹,并且在那个文件夹中你已经定义了页面模板。 And second, you might want to follow this guide for creating and registering page template.其次,您可能希望按照本指南创建和注册页面模板。

Or if you want to skip java module altogether and do it just as a light module you can follow the guide here .或者,如果您想完全跳过 java 模块并将其作为轻量级模块执行,您可以按照此处的指南进行操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM