Ghost nodes in MSM | Community
Skip to main content
Level 2
March 12, 2024
Solved

Ghost nodes in MSM

  • March 12, 2024
  • 1 reply
  • 746 views

The ghost nodes that get created while cancelling inheritance have div wrapped and create unnecessary space on the page. How can this be handled , avoid the space from coming in the publisher without any code changes to the container etc. Do we have any hotfix or configurations to avoid the issues that ghost node causes?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SureshDhulipudi

 

AEM creates a placeholder or "ghost" node for the component in the child page.

Did you try CSS style - apply display 'none' .

Generally these type will handle in CSS style classes. 

or need to create a custom component to handle this scenario - Create a custom component that doesn't output any markup when it doesn't have any content. You could then use this component as a wrapper for the components where you're cancelling inheritance.

or other way is post processing with sling filter

Implement a post-processing step that removes the empty divs from the HTML before it's sent to the browser. This could be done using a filter in the Sling processing pipeline.

1 reply

SureshDhulipudi
Community Advisor
SureshDhulipudiCommunity AdvisorAccepted solution
Community Advisor
March 12, 2024

 

AEM creates a placeholder or "ghost" node for the component in the child page.

Did you try CSS style - apply display 'none' .

Generally these type will handle in CSS style classes. 

or need to create a custom component to handle this scenario - Create a custom component that doesn't output any markup when it doesn't have any content. You could then use this component as a wrapper for the components where you're cancelling inheritance.

or other way is post processing with sling filter

Implement a post-processing step that removes the empty divs from the HTML before it's sent to the browser. This could be done using a filter in the Sling processing pipeline.

Sahana_SAuthor
Level 2
March 13, 2024

Thank you @sureshdhulipudi . I guess all the solutions would work and the fastest would be the CSS/JS. I can get all the elements with class-ghost and hide them on page load.