Factorisation of the template for displaying badges