Show Menu
TOPICS×

Create Nodes

Overlay the comment system with a custom version by copying the minimal number of files necessary from /libs into /apps and modifying them in /apps.
The contents of the /libs folder are never edited because any re-install or upgrade may delete or replace the /libs folder while the contents of the /apps folder is left untouched.
Using CRXDE Lite on an author instance, begin by creating a path in the /apps folder which is identical to the path to the overlaid components in the /libs folder.
The path being duplicated is
  • /libs/social/commons/components/hbs/comments/comment
Some nodes in the path are folders and some are components.
  1. Create /apps/social (if it does not already exist)
    • Select /apps node
    • Create > Folder ...
      • Enter Name: social
  2. Select social node
    • Create > Folder...
      • Enter Name: commons
  3. Select commons node
    • Create > Folder...
      • Enter Name: components
  4. Select components node
    • Create > Folder.. .
      • Enter Name: hbs
  5. Select hbs node
    • Create > Create Component...
      • Enter Label: comments
      • Enter Title: Comments
      • Enter Description: List of comments without showing avatars
      • Super Type: social/commons/components/comments
      • Enter Group: Communities
      • Click Next until OK
  6. Select comments node
    • Create > Create Component...
      • Enter Label: comment
      • Enter Title: Comment
      • Enter Description: A comment instance without avatars
      • Super Type: social/commons/components/comments/comment
      • Enter Group: .hidden
      • Click Next until OK
    • Select Save All
  7. Delete the default comments.jsp
    • Select node /apps/social/commons/components/hbs/comments/comments.jsp
    • Select Delete
  8. Delete the default comment.jsp
    • select node /apps/social/commons/components/hbs/comments/comment/comment.jsp
    • Select Delete
    • Select Save All
In order to preserve the inheritance chain, the Super Type (property sling:resourceSuperType ) of the overlay components are set to the same value as the Super Type of the components being overlaid, in this case
  • social/commons/components/comments
  • social/commons/components/comments/comment
The overlay's own Type (property sling:resourceType ) must be a relative self-reference so that any content not found in /apps is then looked for in /libs.
  • Name: sling:resourceType
  • Type: String
  • Value: social/commons/components/hbs/comments
  1. Select the green [+] Add
    • Name: sling:resourceType
    • Type: String
    • Value: social/commons/components/hbs/comments/comment
  2. Select the green [+] Add
    • Select Save All