How to index external content using the Run macro

Description

There are many macros available that allow for external content to be displayed in Confluence. For instance, macros from SQL for Confluence, HTML for Confluence, and Excel for Confluence. Even though the content appears on a Confluence page, the data will not be included in the Confluence search index since it is not included in the wiki markup of the page. One way to include the content so that it is searchable in Confluence is to use the run or run-now macro to export the content to an attachment. Attachments in Confluence are added to the Confluence index and, therefore, are searchable. In this case, the search will find the attachment. How to index external content using the CACHE macro is another alternative.

Considerations

  • The content should be independent of the user accessing the page, otherwise the content will change depending on who last visited the page
  • Use the cache macro to prevent excessive processing resulting from getting the content, creating an attachment, and indexing the content on each page visit

Example

Using wiki notation:

{run-now:autoExport=true|exportFile=^address.html|exportVersion=replace}

{sql-query:datasource=testDS}
select * from address
{sql-query}

{run-now}