Livesearch Macro
The Livesearch macro allows you to add a search box to a Confluence page. When users enter a search term into the search box, Confluence will dynamically display matching results as they type.
Using the Livesearch macro
To add the Livesearch macro to a page:
- In the Confluence editor, choose Insert > Other Macros
- Find and select the required macro
Speeding up macro entry with autocomplete: Type { and the beginning of the macro name, to see a list of suggested macros. Details are in Autocomplete for links, files, macros and mentions.
To edit an existing macro: Click the macro placeholder and choose Edit. A macro dialog window will open, where you can edit the parameters of the macro.
Parameters
Parameters are options that you can set to control the content or format of the macro output. 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
).
Parameter | Default | Description |
---|---|---|
Restrict to this Space Key | all spaces | Specify a space key to limit the search to the given space. Case-sensitive. Alternatively, use |
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 ) | medium | Choose 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 ) | all | Specify the content types to be included in the search - choose from pages, blogs, comments, space descriptions, or all content types. |
Additional(additional ) | space name | Display the space name, a page excerpt or nothing under the search result. |
Code examples
The following examples are provided for advanced users who want to inspect or edit the underlying markup for a Confluence page.
Macro name: livesearch
Macro body: None.
Storage format example
<ac:structured-macro ac:name="livesearch">
<ac:parameter ac:name="additional">page excerpt</ac:parameter>
<ac:parameter ac:name="placeholder">Search this space</ac:parameter>
<ac:parameter ac:name="labels">myLabel</ac:parameter>
<ac:parameter ac:name="spaceKey">
<ri:space ri:space-key="SS"/>
</ac:parameter>
<ac:parameter ac:name="type">page</ac:parameter>
<ac:parameter ac:name="size">large</ac:parameter>
</ac:structured-macro>
Wikimarkup example
{livesearch:spaceKey=DOC|size=large|placeholder=Search this space}