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:

https://confluence.atlassian.com/display/DOC/Working+with+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: https://marketplace.atlassian.com/plugins/net.customware.confluence.plugin.scaffolding

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">
   AJS.$(document).ready(function(){
      alert( "Is tinymce active editor: "+tinyMCE.activeEditor );
   } );
</script>

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

372 views 20 10
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