Identity emails causing error with Eleventy build

I’m trying to use the identity generated emails with my Eleventy site.

On site build with Eleventy I receive this error because of the unrecognized code that this template uses.

Error
Template render error: (./email/Email-change.html) [Line 133, Column 139]
      unexpected token: .
        at Object._prettifyError (C:\Users\kyles\Desktop\moonface\node_modules\nunjucks\src\lib.js:36:11)
        at Template.render (C:\Users\kyles\Desktop\moonface\node_modules\nunjucks\src\environment.js:536:21)
        at C:\Users\kyles\Desktop\moonface\node_modules\@11ty\eleventy\src\Engines\Nunjucks.js:236:14
        at new Promise (<anonymous>)
        at C:\Users\kyles\Desktop\moonface\node_modules\@11ty\eleventy\src\Engines\Nunjucks.js:235:14
        at C:\Users\kyles\Desktop\moonface\node_modules\@11ty\eleventy\src\Engines\Html.js:14:16
        at Template.render (C:\Users\kyles\Desktop\moonface\node_modules\@11ty\eleventy\src\TemplateContent.js:199:28)
        at runMicrotasks (<anonymous>)
        at processTicksAndRejections (internal/process/task_queues.js:93:5)
        at async Template._getContent (C:\Users\kyles\Desktop\moonface\node_modules\@11ty\eleventy\src\Template.js:547:12)
Cause of error
<p>Follow this link to confirm the update of your email from {{ .Email }} to {{ .NewEmail }}:</p>
<p><a href="{{ .ConfirmationURL }}">Change Email</a></p>

I’ve also opened an issue on the Eleventy Github but I thought It’d be wise to run it by the Netlify crew aswell.

Hey @kylesloper,
Are you still running into this issue or was it resolved with some of the Identity troubleshooting we did yesterday?

1 Like

Hi yeah I was just coming back to update.

This problem was more so Eleventy related than Netlify so I reached out to those guys and it was a pretty simple fix.

I just added a new rule in .eleventyignore like this:

README.md
.github/
email/

Then I just put all of my email templates inside the email folder so that when it came to the Eleventy build, the files weren’t processed, avoiding an error.

1 Like

Awesome, glad to hear it’s resolved with a simple fix!

1 Like