adding conditional logic to the title element