Using macros in templates in Confluence 4

Alan Bowman September 28, 2011

Hello,

Is it possible to include macros in templates in Confluence 4? I'm creating Space tempates, and would like to have things like the table of contents macro automatically inserted.

Thanks,

Alan

3 answers

1 accepted

1 vote
Answer accepted
Matt
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 28, 2011

Looks like you found a bug Alan. I've raised it for you on out public issue tracker:

https://jira.atlassian.com/browse/CONF-23346

While preview does not work when you do create a page from that template it will work.

Alan Bowman September 28, 2011

Well, leave it to me to find a bug. And yes, the template and macros work, even though it throws an error in Preview. Thanks for the assistance.

0 votes
Matt
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 28, 2011

@Jason Vance - here's a little screencast of the workaround suggested above in action. There might even be a little peek another editor feature in the works... :)

0 votes
Matt
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 28, 2011

Yes it is, Alan. At the moment, templates will still remain in wiki markup. Ideally you should be able to use the new editor when creating/editing templates. We do have plans to, it is in the backlog.

For now you can continue to enter the wiki markup of the macros you wish to include in your template. For Tabkle of Contents the mark up is:

{toc}

Alan Bowman September 28, 2011

Matt,

That was the first thing I tried. However, that gives a NullPointerException on Preview. For example, I have this in a template:

h3. Name of document
{toc}

When I click on Preview, I get this message in an error box just under Name of document:

Error formatting macro: toc: java.lang.NullPointerException

Any ideas?

Jason Vance December 28, 2011

@Matt Hodges [Atlassian] - you mention the ability to use the new editor to create/edit templates ... is there a place I can vote on this? Did a search and couldn't find it ...

Matt
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 28, 2011

Hey @Jason Vance - Here's the feature request.

In the intermin. here's a work around I have been using on our internal instance:

1. Create a new page that is really just a template and name it as such i.e. Meeting Notes Template

2. Restrict the editing of the page to those that you wan to have the ability to make changes to the template

3. Save the page

4. From that page's Tools menu right-click the 'Copy' menu item and selct 'Copy link'

5. On another another page, create a link using the link you copied in the step above. The alias coule be something like 'Create New Meeting Notes'

6. Save the page

7. Clicking on this link will open a new page with the contents of the page you created in step 1

Hacky :) but it works until we get you the new editor for creating page templates.

Matt
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 28, 2011

@Jason Vance - here's a little screencast of the workaround suggested above in action. There might even be a little peek another editor feature in the works... :)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events