Hi,
I'm new to the forums and was hoping I could get some help, somewhat new to developing in confluence so bear with me.
I was wondering if there was a plugin or a method to apply a macro to all children pages of a specific space. For example, my space 'test' has 100 children pages/news and i'd like to automatically add the macro to all the pages (by adding {testmacro} to the wiki-markup of each page)
I was told to create my own confluence plugin but I ran into several problems with maven and was thinking maybe I'd look to see if there was already a method to do this.
Thanks in advanced,
Daniel
Unfortunately this doesn't work, if the macro is part of a plugin (written as a Java class which implements com.atlassian.confluence.macro.Macro).
Or i failed to reference it properly.
Neither
$helper.renderConfluenceMacro("{mgnl-space-jump}")
nor
{mgnl-space-jump}
worked, when i was adding the snippet into the header of the space.
mgnl-space-jump is both the name and the key of the macro. The macro is registered in the atlassian-plugin.xml like this:
<xhtml-macro name="mgnl-space-jump" class="info.magnolia.sys.confluence.plugin.mgnltools.macro.SpaceJump" key="mgnl-space-jump">
<parameters/>
</xhtml-macro>
Can anyone help, please?
If you have permissions, you can edit the space's Page Layout and add the macro in the markup by using the $helper.renderConfluenceMacro() method; for example:
$helper.renderConfluenceMacro("{testmacro}")
hth,
matt
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Matthew,
I want {Children Display} in all the pages and would like to use this in the Page Layout - $helper.renderConfluenceMacro("{Children Display}"). Where exactly should I place this?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
"edit the space's Page Layout and add the macro in the markup":
Edit the space using a URL similar to:
http://yoursite.com/spaces/listdecorators.action?key=spacename
Selec the Space Admin tab.
Under Content Layouts, click Create Custom next to Page Layout. If you've already customized the page layout, click the Edit button.
In that decorator, add it where you want it to appear. Takes a little playing around before you might understand all the little pieces in there, but the HTML fragments should be sufficient to help you figure it out.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Daniel,
It worked for me. But I get the page title and the navigation menu at the bottom of the page (wherein I wanted them to appear at the top of the page).
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Which of the sections did you place the markup? Navigation, Header or Footer?
I think you may have put it into the header of the page. The header is rendered above the page title and edit dialog box on the page. If you want it to render of the body of the page you are going to have to go through on a page by page basis and insert this macro. There is no way to my knowledge to globablly apply a macro to all pages other than what Matt suggested.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Daniel,
Matt's solution to this problem is an excellent one. Modifying the layout of a space is a great way of injecting a macro into all pages in a space.
If you are using a Theme like the Documention Theme you will not be able to modify the layout of a space. Your option here would be to visit the Space Admin > Themes > Configure Theme. You can then place the {children} macro in the Navigation, Header or Footer portion of the teme.
Please let us know if that will work for you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Daniel,
It worked for me. But I get the page title and the navigation menu at the bottom of the page (wherein I wanted them to appear at the top of the page).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Like I said, spend some time getting to know the decorators. I did this when I first started mucking around: I edited the global and page layouts and inserted a code (numbers and/or letters) every couple of lines. Then I requested the pages in Confluence, and cross checked where the codes showed up with what macro or Velocity syntax or HTML was in the decorator. Then I went in and commented the files and removed the numbers so I'd know where to start when I wanted to make changes. (I was working on a staging site, so I didn't have to worry about users seeing my "numbering".)
Not the smoothest approach, but it really helped me understand the structure of these files. It's a shame they aren't better documented to begin with!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
+1 to improving the documentation on velocity syntax. If you notice any pages that need some attention please email dborcherding at atlassian.com a link. I will do what I can to help with the docs.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It looks like I'll have to switch themes, then edit the original theme, then switch it back. Is this safe to do without causing unwanted changes to the pages within the space?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you have permissions, you can edit the space's Page Layout and add the macro in the markup by using the $helper.renderConfluenceMacro() method; for example:
$helper.renderConfluenceMacro("{testmacro}")
hth,
matt
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Maybe there's an easier way to do what you're trying to do. What outcome do you want from this from a user's point of view?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.