Extract all common sidebar code