In
AEM 6.0 version, as part of social communities’ project AEM implemented a
handlebar script files in place of JSP scripts.
As part of this project AEM SCF community implemented a handle bar
engine which in turn uses handlebars.java(jknack) library to compile and execute
handlebar templates.
Example:
Let’s say I have a component called helloworld and the
path of component is /apps/mysite/components/content/helloworld.
Below three steps we
need to do to implement header component.
1.
Register a HBS component
To register HBS
component we need to implement SocialComponentFactory interface and then we
need to override methods. In “getSupportedResourceType” method we need to
return component path to register it to handlebar engine. Once we register a component json response
will automatically available to handlebar script file.
Example:
The key aspect is to override getSocialComponent method(Resource).
2.
Create a POJO class and extend the
BaseSocialComponent class.
POJO class represents
the json response that needs to be sent. We can define custom json attributes
that are needed in handlebar script file.
Example:
3.
Handlebar script file:
Handlebar script needs to written in .hbs file.
Json response that is
returned from step2 will be automatically available to hbs file as a context
object.
Logo {{logoUrl}}
Application Url {{appUrl}}
Please refer following documentation to get more insight in the subject.
http://aem-docs.tostring.me/?d=/docs/ko/aem/6-1/develop/communities/scf/server-customize.html
Please leave any comments or feed back ,if you have any question or run into any issues.
Please refer following documentation to get more insight in the subject.
http://aem-docs.tostring.me/?d=/docs/ko/aem/6-1/develop/communities/scf/server-customize.html
Please leave any comments or feed back ,if you have any question or run into any issues.
Comments
Post a Comment