Hi @abilashra,
I think, you cannot dynamically set values like the page title in the initial/.content.xml because that XML is static and processed at template creation time, before the page is created - so dynamic values like jcr:title from page properties aren’t available yet.
May be you could try below 2 options:
1. Use HTL to reference page title at runtime
Instead of hardcoding a value in .content.xml, let the HTL (Sightly) template read the page title dynamically:
<h1>${pageProperties['jcr:title']}</h1>
- No need to modify your model or text component logic.
- Only works if your component supports rendering via HTL.
2. Use a custom page creation workflow or listener
If you truly want to populate the component’s property (e.g., text) with the page title at creation time, you’ll need to:
Example logic (in a servlet or listener):
Node textNode = page.getContentResource("root/text").adaptTo(Node.class);
String title = page.getProperties().get("jcr:title", "");
textNode.setProperty("text", title);
I don't think you can reference ${pageProperties['jcr:title']} directly in .content.xml like:
text="${pageProperties['jcr:title']}"
because the XML is not evaluated dynamically.
Hope that helps!