Add logic for left and right conditional sidebar display

This replaces an earlier PR which caught hell when rebasing.