Add metadata to sidebar of results page

Refactor sidebar rendering into a separate view to be able to
reuse code.