added logic to jade templates