ActiveCampaign/mailmason

Does the preheader feature work?

Closed this issue · 4 comments

A few months ago I upgraded mailmason to take advantage of the built in deployment to postmark as well as the first class support for postmark Layouts. I think I broke preheaders when I made that change.

As far as I can tell Layouts only support the {{{ @content }}} placeholder and has no other mechanism for a template to inform the layout - for example by providing a preheader that should sit above all the other content in the Layout.

Is there a work around to get preheaders working? Thanks!

Seems that preheader does not work as it's defined in a handlebar configuration of a template, for example:

---
layout: basic-full/content.hbs
preheader: "Use this link to reset your password. The link is only valid for 24 hours."
---

However the grunt task replace:postmarkConfig removes this configuration during the build:

      // Remove handlebars config
      postmarkConfig: {
        src: [`${path.dist}postmark-templates/**/content.hbs`],
        overwrite: true,
        replacements: [{ from: /(---)(.*)(---)/s, to: '' }],
      },

Not only that the pre-header does not work, but also any other variable set into the template is being removed. I just spent like 2 hours trying to figure this out, because the compiled templates do work fine.

EDIT: Actually the preheader will not work even when this is solved, because it's defined in the template and used in the layout. These are separated when uploading to postmark type template + layout setup.

Hey folks,

Preheaders were definitely broken when we introduced Postmark layouts to MailMason. Sorry about the trouble. I put together a quick fix on #51. It's not perfect, but it should get preheaders working on your Postmark layouts again.

Be sure to mirror the changes to the Gruntfile and add {{ pm:preheader }} to your handlebars layout next to the opening <body> tag. Then when sending your email via Postmark, you will then need to set the preheader text from the template's JSON model since the preheader is defined in the layout.

Give this a shot and let me know if it works.

will these changes be merged into master or should we integrate them into our own branch? thanks

@evolmk This is merged to master now. Let me know if you have any questions. Thanks!