Automatically deduce template name