remove repetitive code by using jinja2 blocks