#22572 Final changes to support optional name key in templates