Removed unnecessary string replacements

If `.html` is removed from the end only to be added to the end, there's no reason to touch it. Also, `template` + `/` is the same as `template/`. 

I haven't tested this, but I see absolutely no reason why this code isn't the same functionally.