It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to set default template for home page and child pages

hello friends,

We are working on creating automated templates for each spaces in our confluence.

Requirement is when user Click "Create" or" ... "or "Create child page" . It should redirect to template that we defined.

Could you please suggest any workaround for this ?

Thanks in advance.

1 answer

0 votes

Hello Ganesh,

Thank you for contacting us!

You can promote specific templates within individual Spaces. See Promote templates in the Create dialog for more details.

If you're looking to change the behavior of the primary Create button, then I am afraid this is not possible. There is a feature request for this below:

 As a workaround, a solution is that you could use the Create from Template Macro. On any page, you can include this add-on to ensure that users are creating pages from the template that you specify. 

If you're comfortable modifying your site using Custom HTML, then there is another solution for you to try. Please note that this is an unsupported workaround. This workaround was created by my colleague in 2018, and so it can change slightly with future versions of Confluence. If you have any issues after applying this workaround, you'll want to undo the changes.

1. Create a global template (or use existing one) from General Configuration > Global Templates and Blueprints > Add Global Template
2. After Template is created, edit it, if you have an existing template you want to use, edit that one instead.
URL will contain entityId of the template, like such:

http://Confluence_URL/pages/templates2/editpagetemplate.action?entityId=123456

In the example above, entityId for my Test template was 123456, yours will be different.

3. Take a note of the entity ID and go to Custom HTML from your Confluence Administration page. 
Click Edit and add bellow script, replace <numbers> with entityId of the template you wish to use

<script>
  AJS.toInit(function(){
      AJS.$('#quick-create-page-button').attr("href", "/pages/createpage-entervariables.action?templateId=<numbers>&spaceKey=~" + AJS.params.remoteUser);
  });
</script>

 If the user does not have a Personal Space created, then the script above will not work, see How to override quick create page button in Confluence 5.9.xKB for more details.
Basically, you need to remove AJS.params.remoteUser addition and add space name following spaceKey instead of <space name> field bellow:

<script>
  AJS.toInit(function(){
      AJS.$('#quick-create-page-button').attr("href", "/pages/createpage-entervariables.action?templateId=<numbers>&spaceKey=<space name>");
  });
</script>

4. Save your Custom HTML and test page creation, check if it's working as expected.

Let us know if you have any questions about this.

Regards,

Shannon

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

What project did you transition or start on Confluence with the shift to remote work?

It’s been great to hear from fellow users over the last few weeks about the best tips and fun moments you’ve had working on Confluence since the transition to working remote. I’d love to keep the c...

32 views 2 4
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you