To follow the same pattern as a pages template you should return 'none' if @metadata.permalink is undefined and check for @metadataTemplate isnt 'none' in getFilename