Content Fragments can be rendered onto a page by below different ways:
Enable AEM core components
Create a new project called “aemquickstart” using Adobe’s project archetype. Below is a maven archetype command to use. This will generate a boilerplate project with the latest version of Core Components.
- Using AEM core components
- Using Custom Sling Model
- Using Servlet to access Content Fragment.
Enable AEM core components
Create a new project called “aemquickstart” using Adobe’s project archetype. Below is a maven archetype command to use. This will generate a boilerplate project with the latest version of Core Components.
mvn -B archetype:generate
-D archetypeGroupId=com.adobe.granite.archetypes
-D archetypeArtifactId=aem-project-archetype
-D archetypeVersion=23
-D aemVersion=cloud
-D appTitle="AEM Quickstart"
-D appId="aemquickstart"
-D groupId="com.aemquickstart"
-D frontendModule=general
-D includeExamples=n
Run below maven command to install the package in AEM
mvn clean install -PautoInstallPackage
Content fragment and content fragment list core components under ui.apps sub module
/aemquickstart/ui.apps/src/main/content/jcr_root/apps/aemquickstart/components/content/contentfragment
/aemquickstart/ui.apps/src/main/content/jcr_root/apps/aemquickstart/components/content/contentfragmentlist
Let's add these components to the page.
Now we can see the content fragment info on the page.
Content fragment and content fragment list core components under ui.apps sub module
/aemquickstart/ui.apps/src/main/content/jcr_root/apps/aemquickstart/components/content/contentfragment
/aemquickstart/ui.apps/src/main/content/jcr_root/apps/aemquickstart/components/content/contentfragmentlist
Let's add these components to the page.
- Go to AEM Start > Sites > aemquickstart > US > English
- Click on the parsys
- Click the plus icon
- Select Content Fragment
- Edit the content fragment
- Select the "AEM Book" content fragment that we created in the previous post
- Add Title, Description, Release Date and Image elements as shown below.
- Save the dialog
Now we can see the content fragment info on the page.
No comments:
Post a Comment
If you have any doubts or questions, please let us know.