How to use CQL Macro to build a corporate encyclopedia


  • Information for same topic is scattered around in different spaces

  • Users might not know the keywords that they can use to look for help with

  • It takes a lot of time to collate information from all sources and keep them up-to-date in a single page

The image below shows a simplified scenario whereby a page containing several key terms can be quickly created and can benefit from usage of CQL Search Macro.

Proposed Solution

  • Create template containing CQL Search Macro which will use the page title as the keyword to search for related content

  • The template can be used with Create from Template Macro to add new pages easily for each key term


The image below shows how the template can be used to collate all information on “Macro”.

Similar pages can be created quickly for other terms (E.g. tutorial, testing, setup) presented in a main page.

For the above page, the template is configured as follows:

  1. Create template with name “Confluence Search Entry Template”

  2. Add CQL Search Macro in the template

    1. Set the CQL to find all pages and blogposts which is labelled with confluence and contains the keyword matching with page title of the current page

      label = ‘confluence’ AND type IN (blogpost, page) AND text ~ $$query*$$
    2. Set Default Query Term to $self which will replace $$query*$$ with the title of the current page containing the CQL Search Macro