How to add a searchbox in confluence sidebar?

Hello. Thanks for reading!

I am trying to add a simple searchbox above the Page Tree in the sidebar when using the confluence default theme. We're already heavily invested in configuring this theme to our liking and this is one of the final steps.

I've modified multiple decorator style layouts inside the Confluence admin area and added #searchbox() (per https://confluence.atlassian.com/display/CONFEAP/Working+With+Decorator+Macros )to multiple lines but never got anything to show except the actual text which was on the page and not the sidebar.
I also opened up and edited a couple .vm files and inserted that same decorator macro as mentioned on the page above (Again - #searchbox()) with no result anywhere. 
Can someone point me in the right direction to throw a simple searchbox at the top of the page tree in the sidebar on the default theme?

Thanks in advance!

 

2 answers

1 accepted

Go to Page Layout and may be modify this as below

#if( ($mode != "edit" && $mode != "edit-preview" ))
<content tag="ia-sidebar">
	#foreach ($webPanel in $webInterfaceManager.getDisplayableWebPanels("atl.page.left.sidebar", {"page": $confPage, "context": $context}))
	    <br/><br/>
    	$!webPanel.getHtml($action.context)
		<br/><br/>
    #end
	$helper.renderConfluenceMacro("{livesearch:spaceKey=TES|size=medium|placeholder=Search this space}")
</content>
#end

Thanks! The line breaks only move the searchbox down so I have to find a way to squeeze it in but this works. Thank you again.

Matt, did you ever figure out how to tweak this so it looks right in the sidebar?

Hi Matt,

You can give it a try with this, use $helper.renderConfluenceMacro in your layouts to render Confluence macros, for example: Use Confluence livesearch macro
$helper.renderConfluenceMacro("{livesearch:spaceKey=DOC|size=large|placeholder=Search this space}")

Taha

Thanks for that, Taha. Unfortunately, I still can't get any code (or text for that matter) to show up on the Confluence sidebar. I've tried editing the Space layout, the Page layout as well as multiple .vm files. Can you point me to which file it is that spits the code out for the sidebar? Thanks again for your assistance. It's much appreciated

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Tuesday in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

396 views 17 9
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you