I was wondering if it's possible to use the search macro on a page template.
I have the following need for it:
Whenever I create a space, i need a home page with a search macro for the specific space. The search macro need a space key in order for it to search a specific space.
Can I somehow get it to automatically set the space key, to the space the page is being created in.
For instance, I have a space called TestSpace, with the key TEST. Can I then get the template with the search macro to set the space key to TEST?
I don't think you can have dynamic variables like this in a page template.
There may be another way to do it though (Confluence 5.8+), the search macro that you are using may be able to be replaced with one of the new cql based macros.
The advanced search macro and all the other CQL based search macros all support a "Current Space" filter allowing you to find content in the current space.
Another option will be to consider replacing your page Template with a blueprints which will allow a much richer and more dynamic way to populate the pages. Look here: https://confluence.atlassian.com/display/DOC/Blueprints
You could wrap the livesearch macro in a user macro that will supply the space key for you. The below user macro gives you all of the livesearch macro parameters except the space key. It will auto insert that one.
Embeds a search box into your Confluence page to show search results as you type.
Macro Body Processing:
No macro body
## Developed by: Davin Studer ## Date created: 08/21/2015 ## @param Labels:title=Restrict to label(s)|type=string|required=false|desc=A comma separated list of labels to filter the search by ## @param Size:title=Size|type=enum|enumValues=medium,large|default=medium|desc= ## @param Placeholder:title=Placeholder text|type=string|required=false|desc= ## @param Content:title=Content type to include in search|type=enum|enumValues=all,page,blogpost,comment,spacedesc|default=all|desc= ## @param Additional:title=Additional information|type=enum|enumValues=none,space name,page excerpt|default=space name|desc= <ac:structured-macro ac:name="livesearch"> <ac:parameter ac:name="additional">$!paramAdditional</ac:parameter> <ac:parameter ac:name="placeholder">$!paramPlaceholder</ac:parameter> <ac:parameter ac:name="labels">$!paramLabels</ac:parameter> <ac:parameter ac:name="spaceKey"> <ri:space ri:space-key="$content.spaceKey"/> </ac:parameter> <ac:parameter ac:name="type">$!paramContent</ac:parameter> <ac:parameter ac:name="size">$!paramSize</ac:parameter> </ac:structured-macro>
I attended Atlassian Summit 2019 and learned a lot from the presenters, attendees and knowledgeable Atlassian product managers. The presentations I attended focused on applying Agile, pla...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events