How to use Include Macro

Hello everybody,

I want to include the content of a page within another page. I tried to use the Include Macro, but I don’t get it to work.
I created 2 Pages in the wiki’s main directory called “Pages1” and “Page2”. I want to include the content of Page2 into Page1. As I understand the documentation (http://extensions.xwiki.org/xwiki/bin/view/Extension/Include%20Macro) I put in the source of Page1 this:

{{include document=“Page2” reference=“Page2”/}}

What do I do wrong?
I tried around a lot, with paths, etc, but I can’t find a way to do it work.
I’m using xwiki 10.5 on debian.
Thanks for the help!

Vince

You must only use one parameter, see the doc the include macro which says one of them.

Now your issue is that you probably have nested pages and are missing the trailing “WebHome” parameter in the page reference.

Starting with 10.6RC1 you’ll be able to use the new page parameter which allows you to omit it.

Hello vmassol,

thank you for your reply. I’m new to xwiki and try to understand how it works.

Do you mean:
{{include document=“Page2.WebHome”/}}

It doesn’t work as well. Could you please provide me the right syntax?

If I try
{{include page=“Page2.WebHome”/}}

I get an Error message:
Failed to execute the [include] macro. Cause: [You must specify a ‘reference’ parameter pointing to the entity to include.]. Click on this message for details.

And yes, the to pages are nested in a page called “START”. What should I do?

UPDATE: It works if the pages are not nested! :slight_smile: But, next question, how to use it with nested pages?

Thanks for your help!
All the best
Vince

Try this to find the reference to your page:

You didn’t read fully what I said:

Since you said you’re using version 10.5 of XWiki you obviously can’t use the new page parameter… :slight_smile:

So you have to use the reference parameter.

Hey Vincent,

I got it to work now! :slight_smile:

and I now understand how References works.

Thank you!

All the best,
Vince

cool!