reconstruct the procedure of producing webpage and its html code in init

just remove useless code, make it smaller and easier to maintain and modify