added hasattr to globals to check for template title and scripts