User Macro: Create Below Page

Version 1.1 by Normann P. Nielsen on 2026/11/15 15:43

Purpose

This create a Confluence button that starts a Page creation below a specified space/page combination(that must be valid).

An alternative to the standard "Create" button that alway creates below the current page.

Details

 Macro Name create-below-page
 Macro-Title Create Page below Parent
 Description This Macro creates a button that initiates a new Page creation under a specific existing Page
 Categories Confluence Content
 Documentation URL http://www.mos-eisley.dk/x/EIDzAg
 Definition of User Macro  accept No macro body
 (cross) Escaped
 (cross) Unrendered
 (cross) Rendered
 accept No macro body
 (cross) Escaped
 (cross) Unrendered
 (cross) Rendered

InĀ Custom HTML, the button can be styled as:

.aui-button-below-page {
padding: 0px !important;
padding-left: 5px !important;
width: 20px !important;
height: 20px !important; }

Macro Code

## @param pagetitle:title=Page Title|type=string|required=true|desc=
## @param spacekey:title=Space Key|type=string|required=false|desc=
## @param buttontitle:title=Button Title|type=string|required=false|desc=
## @param buttonhelptext:title=Button Helptext|type=string|required=false|desc=
## @param buttoncolor:title=Button color|type=string|required=false|desc=
## @param buttontextcolor:title=Button Textcolor|type=string|required=false|desc=

#set ($pageManager=$action.getPageManager())

#if (${paramspacekey})
#set($spacekey=${paramspacekey})
#else
#set($spacekey=$renderContext.getOriginalContext().getSpaceKey())
#end

#set($pageid=$pageManager.getPage($spacekey,"${parampagetitle}").getId())
#if (${parambuttontitle} == "")
#set($buttontitle="Create Content")
#else
#set($buttontitle=${parambuttontitle})
#end

#if ($pageid)
<a href="/pages/createpage.action?spaceKey=${spacekey}&fromPageId=$pageid" class="#header aui-button aui-style aui-button-primary aui-nav-imagelink aui-button-below-page" style="background: ${parambuttoncolor}; color: ${parambuttontextcolor};" title="${parambuttonhelptext}">$buttontitle</a>
#else
<a href="Javascript:;" title="Error in create-below-page macro: Space/page does not exist"><font color=red>ERROR</font></a>
#end