Links with pagename variable

I want to create a link that links to a subpage with its own name. Like [[Serverroom>>${currentpage} - serverroom]]. If the page does not exists use a template to create the page.

I was looking at the link full format but can not make any usefull link of it.

Hi Erik,

In the link you have you can find:

Relative link to page PageA from the current page	[[PageA]] or [[.PageA]]

Thus the following should work:

[[Serverroom>>serverroom]]

If you’re on page Page1.Page2 this will link to Page1.Page2.serverroom. If that page doesn’t exist you’ll get a question mark displayed and when a user clicks it, he/she will be able to use a template to create it, see https://www.xwiki.org/xwiki/bin/view/Documentation/UserGuide/Features/DocumentLifecycle/#HByaddingawantedlink

Thanks

Thnx for the quick answer, it is not really what i mean.
lets say i have a client page called ClientA and i want to link to a new page that includes the pagename.

  • ClientA
  • ClientA -> ClientA - Serverroom

I want to use this in a template to create client documentation. Instead of having a lot of serverroom pages i want pages like “clientname - serverroom”

I’m still not sure I understand you. The terminology you use doesn’t match the one used by XWiki so it’s hard to understand your need.

Maybe you want to be able to get the parent’s page name from a given page?

You can do this with:

{{velocity}}
$doc.documentReference.parent.name
{{/velocity}}

Thus in your template you can have:

{{velocity}}
[[$doc.documentReference.parent.name - Serverroom>>$doc.documentReference.parent]]
{{/velocity}}

Vmassol, you are a hero!

i ended with a slight edit

{{velocity}}
[[Serverroom>>$doc.documentReference.parent.name - Serverroom]]
{{/velocity}}

Thnx a lot

Glad it helped!

PS: Make sure to close topics by marking them as solved (the action icon with the checkbox with the tick inside) :wink: Thx

1 Like