How to override the quick create page button in Confluence Data Center

Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.

Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. 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.

*Except Fisheye and Crucible

Purpose

A quick Create page button was introduced in Confluence 5.9.x. For more information, please refer to the Confluence 5.9 Release Note

If you need to redirect the link in the Create button to Create Blogpost instead, you may do so using JavaScript, as highlighted below.

Solution for 9.2.x and above:

  1. Navigate to Confluence Administration page >> Custom HTML.
  2. Click Edit.

Add the following to At the end of the HEAD section and click Save:

<script>
$(document).ready(function() {
    // Function to get the atl_token from the meta tag
    function getAtlToken() {
        return $('meta[name="ajs-atl-token"]').attr('content');
    }
    // Store the atl_token in a variable
    var atlToken = getAtlToken();
    AJS.toInit(function(){
        // Update localStorage values with current spaceKey and pageId
        if (AJS.params.spaceKey != null && AJS.params.pageId != null && AJS.params.pageId != 0) {
            localStorage.setItem("SpaceKey", AJS.params.spaceKey);
            localStorage.setItem("PageId", AJS.params.pageId);
        }
        // Set the href attribute of the "Create" button with the updated values
        if (localStorage["SpaceKey"] != null && localStorage["PageId"] != null) {
            AJS.$('#quick-create-page-button').attr("href", "/pages/createpage-entervariables.action?templateId=nnnnnnnnn&spaceKey=" + localStorage["SpaceKey"] + "&fromPageId=" + localStorage["PageId"] + "&atl_token=" + encodeURIComponent(atlToken));		
        }
    });
});
</script>	

3. Note to replace the "nnnnnnnnn" with the correct ID and append any context path to the url if one exists.


(warning)  Note: While there is a gap between 8.5.x and 9.2.x on this page, these haven't been tested yet, yet most likely one of the two scripts on this page will work.

Solution for 5.9.x to 8.5.x

  1. Navigate to Confluence Administration page >> Custom HTML.
  2. Click Edit.
  3. 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>
  4. 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>
  5. 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>




Last modified on Mar 20, 2025

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.