'Confluence Cloud: Macro to display a list of links to spaces where the space title or space key are matching a pattern
In Confluence Cloud, I'm trying to display a list of links to spaces, where the space title or space key are matching a pattern.
Specifically, our spaces names are prefixed by the space key, and the space keys are our project numbers with the two first characters in the space name specifying the department the space belongs to. eg. "RD1234" and "QA1078"
I'm hoping to display a list similar to the Children Display macro, but of spaces starting with a specific prefix, such as "RD*" or "RD????*. Even better, matching a regex expression.
The results I've had so far are depressing. It looks like spaces are purely supported in confluence:
The Search Result Macro:
Pros:
- Can search for a substring, such as
"RD" - Generates a list of spaces.
- Supported by the old Confluence editor.
Cons:
- No option to search start of a string, or with wildcards.
- Searches for a specific substring, without a wildcard so if searching for "RD", a space named "QA1234 Something for RD1234" will generate a false positive. :-/
- Not supported by the new Confluence editor.
The CQL Query plugin:
Pros:
- Can search for a substring with limited support for wildcards, eg. can search like this:
space ~ "RD????" - Working in the new Confluence Editor
Cons:
- Appear to not be able to create a list of spaces, but only of items related to a space.
- No option to search start of a string, and only with limited use of wildcards.
- False positives: Searches for a specific substring such as "RD????", a space named "QA1234 Something for RD1234" will generate a false positive. :-/
- Not working in the old Confluence Editor. (Although other CQL search plugins may work)
The CQL search anchor:
This appears to only be supported in the new editor, and should simply consist of putting a special formatted URL into an onsite link, such as https://MYHOSTEDSITE.atlassian.net/wiki/dosearchsite.action?cql=space+%3D+%22RD%2A%22
The format should be the CQL string.
Although it's mentioned here and there, it's not really documented anywhere, and I can't make it work on my setup.
Any comments or pointers on how to create this sort of list (preferable in a similar manner for both the old and the new editor) are highly appreciated.
Solution 1:[1]
After trying a lot of things, I finally found the commercial Search Results Macro+ for Confluence addon, which nearly did what we wanted. The author of the addon quickly added a few missing details (Thanks!).
We have been using the addon for more than a month now, and it's a joy. Much better and with many more options than the original Search Results macro from Atlassian.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | fsteff |
