How to override quick create page button in Confluence 5.9.x
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Fisheye および Crucible は除く
目的
In Confluence 5.9.x, quick Create page button is introduced. For more information on this, please refer to Confluence 5.9 Release Note.
If you need to redirect the link in the Create button to Create Blogpost instead, you may do so by using JavaScript as per highlighted below.
ソリューション
- Navigate to Confluence Administration page >> Custom HTML.
- 編集をクリックします。
Add the following to At the end of the HEAD section and click Save:
If the user does not have a Personal Space created, then the script below will not work.
The user will get Page Not Found error instead.
Workaround: Use pre-defined space for all users instead of personal space. Just
<script> AJS.toInit(function(){ AJS.$('#quick-create-page-button').attr("href", "/pages/createblogpost.action?spaceKey=~" + AJS.params.remoteUser); }); </script>
You can also use pre-defined Global template (please replace <numbers> with entityId of the template which can be found in URL during editing the template)
<script> AJS.toInit(function(){ AJS.$('#quick-create-page-button').attr("href", "/pages/createpage-entervariables.action?templateId=<numbers>&spaceKey=~" + AJS.params.remoteUser); }); </script>
- Below is an example also to use pre-defined Global template and create as a subpage to your current page (please replace <numbers> with entityId of the template which can be found in URL during editing the template)
<script>
AJS.toInit(function(){
AJS.$('#quick-create-page-button').attr("href", "/pages/createpage-entervariables.action?templateId=<numbers>&spaceKey="+AJS.params.spaceKey+"&fromPageId="+AJS.params.pageId);
});
</script>