Forums

Removing repeating codes

How can I remove repeating codes in different html files.

I want to have a file which contains repeating codes in every html files and call it using a simple code. This way I can alter one file and it will be applied to all the html files.

For example, php uses <?php include ('content.html'); ?> and call content from content.html in different html files.

It is really difficult to edit trivial errors. I have to go through every html files to make changes every time.

Please help!

Which Python web framework are you using? The way you avoid duplication is different depending on whether you're using Django, Flask, Bottle, web2py, or another framework.

Flask

OK, so Flask templates have an include function, just like PHP. Here's a link to the documentation.