Split out sidebar code from the search code so it can be reused for the