How to modify the Page property in the code and set it back
How to modify the Page property in the Page component jsp and set the new modified value back to the Page property by setProperty(..,...) method? Can we set the Page property back?
My Situation is I want to set the Unique Page ID for every page I create, So I would like this to be a Page Property.
I am considering the the current datetime is unique feature, So I want to convert this current datetime to unix time value a long value and want to set this PageID property to that page.
I can access the Page properties in the Page component jsp file, But when I try to set the Page property it wont throw error nor it sets my new modified value.
My Code in Component JSP is as below:
SlingRepository repository = resourceResolver.adaptTo(SlingRepository.class);
Session session = repository.loginAdministrative(null);
Node node= session.getNode("Absolute path of the Page");
node.setProperty("jcr:Pageid",Unix Datetime );
session.save();
Any help to create a Unique Page ID will be really appreciated
Thanks a ton in Advance