Add template to top of existing page. How to

Hi all,

I need to be able to add a template to some existing pages in way that it is editable in editor in whole (no include).
I tried by adding a user macro to page which uses AJS.toInit(), resulting in the code to be seen as text on page only.

First, a there any options to be enabled (html macro is enabled!?) besides the user macro rendering options, resources to be defined? As total novice to Confluence 4.1.3 I would appreciate some advice.

3 answers

I'm not sure exactly what you're looking for. Have you checked out the Page Layout and Global Layout templates in the Space Admin? This would be where I would add content that I want to appear on existing pages. It won't let you edit that shared content plus your body text at teh same time, but that should be the case anyway.

Thanks for reply - here is what I'm looking for:)
Some pages need to be get a header that user has to enrich, resp. a template. In order to do so I thought about a user macro which lets user easy add the template. Concatenated content should be seen in editor so user can fill out the integrated header.
I tried code from Use jquery load() function but macro source is "rendered" as text to page, so I guess st. is missing, needs to be activated?

I think what you want are user templates. You define them and then when you create a page, you can set the template on the page. The contents of the templates are copied into the page when it is created so the user can edit it just as they would other user content.

Here's more info on user templates:

Thanks, we are getting closer:)
I redescribe: "Is it possible to add a template to existing pages without recreating the pages?"
This was asked 2010 and the answer was "no, not yet" (see question).

But what I understand from jquery load() function is that it gets the content from page b, resp. a template, concatenates it with content from current page a and loads it to tinymce editor, which is pretty much what I want - I guess.

The problem is: As result I just see the code of the macro as new page content. How do I getting scripting to work? St. is missing, needs to be activated? A resource needs to e defined?

You might want to consider just adding standard text to your existing pages. Of course, once added it becomes part of the page and is no longer "a template", but often we just use the term template to reference standard text blocks. Here is an example that shows how to automate this:

How to automate adding text to Confluence pages

Thanks for your tip but I can't confront users with command line. As I said, getting the 'user macro' to be executed would probably solve.

I didn't understand your question then, so, you want a user while editing a page to be able to draw in a chunk of standard text, make changes and have it part of the page.

We would use a different approach for situations similar to this by using:

You're welcome and thx for the answer - but our budget has reached its limit.
So I went back to the user macro which puts "tinyMCE is not defined" error to
console - which means that the appropiate .js is not properly included??

## @noparams
<script type="text/javascript">
      alert( "Is tinymce active editor: "+tinyMCE.activeEditor );
   } );

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

259 views 2 10
Read article

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