Re: Flask - Jinja2 validation error

> On Mar 6, 2024, at 7:41 AM, Gav 'Spammy' HB <iamslowtrain@gmail.com> wrote:
> 
> Hi,
> 
> I am using a base.html document as a template for other pages using the templating engine Jinja2.  The validation throws an error with the line,

The template file is a mix of HTML and Jinja markup, so it naturally won't often be valid HTML. The file base.html's extension is confusing since it isn't strictly HTML -- it's a template to generate HTML. The Jinja docs even suggest using file names like `base.html.jinja` to make the distinction clear:

https://jinja.palletsprojects.com/en/3.0.x/templates/#template-file-extension

So, you'll want to validate the *output* of the template. I.e. the page generated by Flask/Jinja.

Cheers - Chuck

Received on Wednesday, 6 March 2024 21:38:06 UTC