Summary

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, Excel for Confluence, and Markdown for Confluence plus macros like JSON Table Macro and CSV Macro. Even though the content appears on a Confluence page, the data is not included in the Confluence search index since it is not included in the markup of the page. One way to include the content so that it is searchable in Conflunece is to use the Cache Macro. How to index external content using the Run macro is an alternative way to do this. The advantage of using the cache macro technique is that the search result returned is the actual page the content is on.

Considerations

Index Parameter

An additional parameter is available on the cache macro:

index - If index=true, the cached content is added to the Confluence search index. Default is "false". Whenever the cached data is updated, the page is re-indexed.

Examples

SQL queries

{cache:index=true}
The results from the SQL query will be indexed for search.
{sql-query:dataSource=ReportDS}
select * from report
{sql}
{cache}

Web pages

Using the HTML for Confluence.

{cache:index=true}
The page pointed to by the url will be indexed for search.
{html:script=#http://www.atlassian.com/about/}
{html}
{cache}

How does it work?

Assume there is a page that has a cache macro instance that specifies index=true

What data is indexed?

The cache macro renders contents of the macro into HTML and stores the HTML in the cache. The cache content extractor processes the HTML data from the cache and extracts only the text and attribute fields using the Jericho HTML Parser.