Using macros in templates in Confluence 4

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

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.

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.

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}

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?

@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 ...

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.

@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... :)

@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
Community showcase
Posted Oct 24, 2018 in Confluence

Atlassian Research opportunity with Confluence templates

Do you use templates with Confluence? Take part in a remote 1-hr workshop. You'll receive USD $100 for your time!   We're looking for people to participate in a   remote 1-hr workshop...

1,526 views 25 14
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you