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.
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
This version works on 9.0.1 Data Center:
<script> AJS.toInit(function(){ AJS.$('#quick-create-page-button').attr("href", AJS.$('#quick-create-page-button').attr("href").replace("createpage.action?", "createpage-entervariables.action?templateId=<number>&")); }); </script>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.