Livesearch Macro

Add the Livesearch macro to a page to provide a fully customizable search field. When someone starts typing into the search field, Confluence will suggest matching pages, blogs, or comments. 

This macro is great when you want to:

  • provide a way to search the current space, such as in a knowledge base
  • encourage people to search for particular types of content, such as pages with a particular label.

Because you can limit the search by space, label, content type, you can provide a very targeted search experience for people viewing your space. 

On this page:

Screenshot: page with a Livesearch macro showing search results for the search term 'printer'

Add this macro to your page

To add the Livesearch macro to a page:

  1. From the editor toolbar, choose Insert > Other Macros.
  2. Choose Livesearch from the Navigation category.
  3. Use the parameters below to narrow down the content to be searched.
  4. Choose Insert

You can then publish your page to see the macro in action. 

Screenshot: configuring the Livesearch macro to search for pages with particular labels in a specific space. 


Change the macro parameters

Macro parameters are used to change the behaviour of a macro.

To change the macro parameters:

  1. In the editor, click the macro placeholder and choose Edit.
  2. Update the parameters as required then choose Insert.

Here's a list of the parameters available in this macro. 

Parameter

Default

Description

Restrict to this Space Key
(spaceKey

all spaces

Specify a space key to limit the search to a single space. Case-sensitive. You can't specify multiple spaces.

Alternatively, use @self to restrict the search to the current space.

Restrict to label(s)
(labels

Specify labels to limit the search to content with that label. If unspecified will search all content regardless of label.
Size 
(size
mediumChoose a medium or large search field size.
Placeholder text
(placeholder

Specify the placeholder text to appear in the search field, for example 'Search this space'
Type
(type
allSpecify the content types to be included in the search - choose from pages, blogs, comments, space descriptions, or all content types.
Additional
(additional)
space nameDisplay the space name, a page excerpt or nothing under the search result.

Where the parameter name used in Confluence storage format or wikimarkup is different to the label used in the macro browser, it will be listed below in brackets (example).

Other ways to add this macro

Add this macro as you type

Type followed by the start of the macro name, to see a list of macros. 

Add this macro using wiki markup

This is useful when you want to add a macro outside the editor, for example as custom content in the sidebar, header or footer of a space.

Macro name: livesearch

Macro body: None.

{livesearch:spaceKey=DOC|size=large|placeholder=Search this space}
Last modified on Feb 2, 2021

Was this helpful?

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