Pug not closing title tag

545 Views Asked by At

I am trying to learn Pug. Right now I am trying to get a very simple tutorial template working, but Pug kind of acts like a feminist at Trump's inauguration.

I've managed to get the template working and display stuff. But as soon as I move the header part (which later renders into <head>) into a separate file and try to include it, all hell breaks loose. Particularly because of this line:

title Test template

What is wrong with it? Seemingly nothing... except Pug is not closing the <title> tag, so the rest of the document will be treated as a document title. If I add another line after it, then it closes the <title>, but not the one after it. Looks like Pug has trouble recognizing the last line and rendering it properly.

What am I doing wrong? Or is this a bug?

1

There are 1 best solutions below

0
On

I found the solution. For some reason it only occurs if I don't use blocks. So if I start my header.pug with this:

block header
doctype html
html(lang='en')
  head
...

and include it like this:

include header
block header

it works. This must be a bug. So I just had to add blocks and it's all fine.