Silly question: how can I get "space" of a parent page (and not the full path)?

Hello,

I have a parent page:
./view/BacASable/SousPageParent/EncoreUnePageParent/
and I want a simple velocity code to get this direct parent of a page (and not full path): “EncoreUnePageParent”.

I tried:
$doc.parent
BacASable.SousPageParent.WebHome
$doc.name
WebHome
$doc.fullName
BacASable.SousPageParent.EncoreUnePageParent.WebHome
$doc.getParent()
BacASable.SousPageParent.WebHome
$doc.getParentReference()
xwiki:BacASable.SousPageParent.WebHome
$doc.getSpace()
BacASable.SousPageParent.EncoreUnePageParent

Thxs for your help.

Pascal B

maybe you can try this:

#set($spaceref=$doc.getSpace())
#set($space=$services.model.resolveSpace($spaceref))
$space.name
EncoreUnePageParent

Sounds like

$doc.documentReference.parent.name

Thxs both :slight_smile: