Converting Include Pages Macro to Include Version

If you have multiple Include Page macros on a page, it it is difficult to manually update them. A REST endpoint is included in ScriptRunner for Confluence, which converts all instances of Include Page to Include Version. The version number is specified to be the current latest version, so the page contents should be identical in all instances. The page contents remain identical until one of the includes is modified.

Create the REST endpoint

You can easily hook up this REST endpoint using a web item. Follow these steps to create the web item:

  1. Navigate to General Configuration > ScriptRunner > Fragments.
  2. Click Create Fragment, and then click Custom Web Item.
  3. Fill out the fields that appear in the image: 

    Help with Condition and Link fields

    • For the code in the Condition field, select Example Scripts and then copy the Current page contains particular macros code.
    • The text for the Link field is:  /rest/scriptrunner-confluence/latest/content-info/convert-includes?pageId=${page.id}&#url_xsrfToken()
  4. Click Add.

Results

The following image is the result of this web item being configured:

This result only appears on the pages that contain the Include Page macro.

On this page