My idea is:
A Twig variable available in themes to allow conditional rendering based on whether the theme is rendered through the builder:
{% if isBuilder %}
<!-- code to make the preheader visible -->
{% endif %}
Can be used for conditional code that shows things that should be hidden in emails but visible to users, such as an email preheader.
I think these groups of people would benefit from this idea:
People who send emails
Why I think they would benefit from this idea:
Easier to use features such as preheaders which can be visible in the builder but hidden in email clients
Any code or resources to support this idea:
Provide a “isBuilder” variable when rendering them theme.
Are you willing to work on this idea?:
I can help test
What skills and resources do you need to explore this further?
I think that’s what I mean. I was referring to the email.(twig|mjml]) file.
I was looking for documentation on what Twig variables exist in that scope and ended up reading the source code. From what I could tell, there’s no way to check for the template being rendered in the builder.
Personally, I’d love to see a field on the email edit page (before the builder) for a user to define the preheader and that would get added to the email when it’s sent to the relay service.
I haven’t been able to figure out how to use the headers to build an email with annotations to appear in the Gmail promotions tab, but this seems like it would be related to work to make the preheader text easier to edit: Menganotasi email di tab Promosi | Gmail | Google for Developers
In the Acquia documentation for our email builder, we have code to copy/paste into an HTML block at the beginning of the email:
<div style="display:none;font-size:1px;line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden;mso-hide:all;font-family: 'Raleway',sans-serif;">This is preheader text</div>
<!-- Visually Hidden Preheader Text : END -->
This should work in any builder - we didn’t make any changes between the legacy builder and the BEE builder (which is what Acquia uses, rather than GrapesJS)
The HTML I shared will be accessible in the builder, though you won’t actually see it. Here’s a screenshot with our builder - the pink line you see at the top is the HTML content block, but you can’t actually see any content in it because the HTML contains display:none; to hide the content from the actual email.