Search code examples
denonunjuckslume

Lume omit doctype?


Is it possible in Lume, using Nunjucks, to refrain from rendering a doctype?

I am using Lume to create HTML snippets, destined for another system. (I'm not rendering entire HTML pages.) The doctype gets in the way.

Example input:

<div>Hello world</div>

renders thus

<!doctype html>
<div>Hello world</div>

I'd like it to stop doing that. Thanks.


Solution

  • Lume adds the doctype automatically (see issue), but you can remove it with a preprocessor:

    site.process([".html"], (page) => {
      page.content = page.content.replace("<!DOCTYPE html>\n", "");
    });