Global Template Development from existing Confluence page
Asked by Craig Hylwa:

What is the most convenient way to create a global template from an already existing page. The page contains many macros and formatting. To code it by hand will take alot of time. Is there a way to exract and copy the already existing code?


Answers:
author: Davide Schillaci
body: Hi Craig,

<br />

actually it isn't simple to create a Global Page Template from an existing Confluence page, given only the out of the box features, and developing it might be complicated. That is why we have developed Simply Templates: [https://marketplace.atlassian.com/apps/1219191/simply-templates?hosting=server\&tab=overview](https://marketplace.atlassian.com/apps/1219191/simply-templates?hosting=server&tab=overview), in order to facilitate the creation of global page templates, in case one is a system administrator, space templates for spaces one is the administrator of, and more. In case of interest, check it out. Cheers!

Davide


author: Andrew Frayling
body: Hi Craig,

Possibly a little late for your corporate documentation project, but have a look at the answer posted at [https://answers.atlassian.com/questions/42585/how-to-use-image-effects-in-a-confluence-template](/questions/42585/how-to-use-image-effects-in-a-confluence-template) for a workaround which may work for you.

Sorry if it's too late, but might be worth bearing in mind.

Andrew.


author: Andrew Frayling
body: Hi Craig,

Which version of Confluence are you using?

If you're on 3.x then you can just select Tools -\> View Source on the page that you want to use for the template and copy and paste the macro source into the global template.

If you're on 4.x then things are a bit trickier as the page will use the new XHTML storage format, but you have to use the old wiki markup in the global template. You can view the XHTML storage format source of a Confluence 4.x page by selecting Tools -\> View Storage Format, but you then have to convert the XHTML format to the old wiki markup. E.g.

The {info} macro in Confluence 4.x:

```
&lt;ac:macro ac:name="info"&gt;  &lt;ac:parameter ac:name="title"&gt;Hello World&lt;/ac:parameter&gt;  &lt;ac:rich-text-body&gt;    &lt;p&gt;Well, hello.&lt;/p&gt;  &lt;/ac:rich-text-body&gt;&lt;/ac:macro&gt;
```

would need to be converted to the following in Confluence 3.x:

```
{info:title=Hello World}Well, hello.{info}
```

As far as I'm aware there's no automated way of carrying out this conversion, you'd need to piece it together with the docs for 4.x (<http://confluence.atlassian.com/display/DOC/Confluence+Storage+Format>) and the docs for 3.x (<http://confluence.atlassian.com/display/CONF35/Confluence+Notation+Guide+Overview>) to fill in the blanks.

So if you're on 3.x it's very straightforward, but if you're on 4.x it's a bit of a pain.

Hope that's of some help?

Andrew.

comments: author: Craig Hylwa
body: Using Confluence 4.1 and have roughly 25 individual templates to create for corporate documentation project.


author: Craig Hylwa
body: Using Confluence 4.1 and have roughly 25 individual templates to create for corporate documentation project sh%#!


author: Andrew Frayling
body: Sorry, looks like you'll need to use the more complicated way :-(

That said, it shouldn't be \*too\* complicated. The way I would go about this would be to use Tools -\> View Source to give me the general outline of the page with Tools -\> View Storage Format to give me the macro details. Using the source you should be able to put together the general outline in wiki markup fairly quickly and then use the Storage Format and the docs to fill in the macro parameters.

Sorry again, it was a huge oversight Atlassian not having the new format across all Confluence features when they dropped markup from the editor.

Not that it helps you right now, but you may want to vote for <https://jira.atlassian.com/browse/CONF-11744> which is the feature request to allow XHTML/Rich Text format with global templates. Your use case also provides a concrete example of the pain that customers are having to go through due to the lack of consistency.