Doctype
You can set a global doctype
to be used by all your email templates:
// config.js
module.exports = {
doctype: 'html',
// ...
}
You then reference this in a Layout, from the page
object:
<!DOCTYPE {{ page.doctype or 'html' }}>
Just like above, you can fallback to a default value with Nunjucks templating logic.
Front Matter
You can also use Front Matter, to set the doctype
locally instead of globally.
For example, let's create src/templates/old.njk
and use a Transitional doctype for it:
---
doctype: html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
---
{% block template %}
<!-- ... -->
{% endblock %}
HTML5
The default Layout in the Starter will fallback to an HTML5 doctype. It's the shortest, and it's enough to trigger standards mode.