Add template to top of existing page. How to

T. Frank June 11, 2012

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

1 vote
Matthew J. Horn
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 11, 2012

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.

T. Frank June 11, 2012

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?

0 votes
Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 12, 2012

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

T. Frank June 12, 2012


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.

Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 12, 2012

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

T. Frank June 14, 2012

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>

0 votes
Matthew J. Horn
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 11, 2012

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

T. Frank June 11, 2012

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?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events