Move html code and fix encoding of permalink