New email newsletter templates Premium includes an email newsletter feature, so readers of your blog can subscribe to receive posts by email. It’s designed around microblogs. For example, can gather up lots of short posts over the week or month and collect them into a single email.

Today we’re launching a revamped template system for these emails, bringing much more control over what the emails look like. You can edit the template to add a header or footer, or change the HTML tags completely.

Because emails are generated outside of blog publishing, we can’t really use Hugo directly for this. I’ve written a new helper app in Go to process the templates, so they feel as familiar as possible to people customizing their blog theme. (Hugo also uses Go’s templating language.)

You can see what the default email template HTML source looks like here on GitHub. plug-ins can also override this template! So you could have a plug-in that provided a new email design. There’s a help page here with more details about variables you can use in a template.

This is a major improvement. A couple things to keep in mind:

  • The template is responsible for assembling posts together. Because it produces HTML, you can no longer edit the Markdown of the previewed email. Instead, you can add intro text, edit specific posts, or remove posts from the newsletter.
  • The template could fail if there are syntax errors you’ve introduced in edits. Make sure to test your changes by sending a copy to yourself.

You can edit the template under Newsletter → Settings. If you edit the template and then install a plug-in with a custom newsletter design, it will still keep your changes. You can clear your custom template to revert back to the default template or a plug-in’s template.

If you’re not comfortable editing HTML, that’s okay. You can continue to use the email newsletter feature and ignore the custom templates. It’s just a little more power under the hood for folks who want it, and for plug-in developers.

Manton Reece @manton