


Hi Team,
I have requirement to add page path in multifield and using that page path to access the page properties in sightly.
anyone worked on such type of requirement.
Views
Replies
Sign in to like this content
Total Likes
Hi @savi50
You can write a sling model for this. Read the page path from the multifield into the sling model. Once you have the page path get it as a resource then adapt it to a Page object. With getProperties() method you can fetch the properties from a Page object.
Below piece of code might help you to get started.
Resource resource = resourceResolver.getResource(<PAGE_PATH_FROM_MULTIFIELD>;
Page page = resource.adaptTo(Page.class);
ValueMap pageProperties = page.getProperties();
Thanks,
Hi @savi50
You can write a sling model for this. Read the page path from the multifield into the sling model. Once you have the page path get it as a resource then adapt it to a Page object. With getProperties() method you can fetch the properties from a Page object.
Below piece of code might help you to get started.
Resource resource = resourceResolver.getResource(<PAGE_PATH_FROM_MULTIFIELD>;
Page page = resource.adaptTo(Page.class);
ValueMap pageProperties = page.getProperties();
Thanks,