How to add pre-defined template to a previously created pages
Asked by A:

Hi,

I created a template using confluence, then I can use my pre-defined template for any new pages that I'll create. But I have some previously created pages without my pre-defined template being applied. Does anyone know how to insert my pre-defined template into my previously created pages?

Any hints/tips are greatly appreciated!


Answers:
author: Phil Schwab
body: I've been investigating the Scaffolding Plug-in that has a so-called "Live Template" concept. I'm trying to verify if it allows for template changes to be reflected in previously created pages. They are saying "Yes".<https://marketplace.atlassian.com/plugins/net.customware.confluence.plugin.scaffolding>


author: Nic Brough -Adaptavist-
body: You can't.

A template is a starting point, a guide for writing a page. It's not part of the page and has no use within, or even relationship with, the page you create from it.

To do this automatically, you would need to embed something in your template that stores "this page was created by" and then write a routine that can find pages tagged with that and intelligently edit them to bring them in line with your template changes.

But you'd still need to go and tag all the old pages if you did it.

comments: author: A
body: Thanks Nic!

I agree with you that I need to write a routine to scan those pages and edit the them to bring them in line with my template content. Currently we have 100+ pages that need to be edited to be in line with my template changes. I'm newbie with Confluence. Only way I do is to find or use the out-of-box confluence feature to get this done. So far I haven't found any. So I might just have to go in to each page to manually update them, which is quite tedious and time consuming. On the other hand, if writing some code/routine can help get this done efficiently, I'm willing to try. Would you be kind enough to shed some light toward that direction?

Here is what I'm trying to do. I created a header page to include the info that needs to be placed on top of each page including child and sub-child pages (total: 100+ pages currently). The header page has the info like this:

"Documentation for XXX Version. Documentation for XXXX and [earlier versions](https://confluence.atlassian.com/display/ALLDOC/Confluence+Documentation+Directory "Confluence Documentation Directory")is available too.".

Below link shows an example of the header info I'm trying to use and create.

<https://confluence.atlassian.com/display/DOC/Confluence+5.7+Release+Notes>

Now I just need to get that header info broadcasted to all child and sub-child pages (100+ pages) of the existing page.

Is there anyway to achieve this goal?

Again, really appreciate your help!


author: Daniel Wester
body: Are you wanting to apply that to all of the pages in the space? If so you can edit the template in the space.


author: Nic Brough -Adaptavist-
body: There is nothing in Confluence that will do this, and no plugins I'm aware of either - that's why I started with "you can't" in the answer.Your simple banner to be included is a good approach because it gives you flexibilty in the future and you don't have to be horribly clever with your edits, just "find page, add section at the top". But, that's where you'll need to either script something or do it by hand