nizz0k
nizz0k

Reputation: 521

How to implement in-email navigation with MJML?

So, I'm trying to code a newsletter using the MJML framework. It's generally great, but I'm not sure how to implement navigation within the body of the email. I would assume it would be implemented using anchor tags with the href pointing to an an element ID with a hash/pound sign in it (e.g. <a href="#someElement">MyLink</a> and <someElement id="#someElement">. My preliminary issue is that MJML doesn't seem to support an ID attribute for the elements. I am aware of the mjml nav extension, but when I looked at the extension it seemed more like a layout component than a functional one. Any advice is appreciated.

Upvotes: 0

Views: 1596

Answers (1)

Nathan
Nathan

Reputation: 5259

The difficulty that MJML have with custom properties is that they don't know where to put them unless they are specified. So, you can't use id in a component unless it is specified in that component. See Github issue

In the meantime, you can write directly like so:

<mj-text>
    <div id="someElement">And this is more text</div>
</mj-text>

Upvotes: 1

Related Questions