Remove trailing whitespace, fix template links