Fix Email Article for Articles with Apostrophes

Customers sometimes run into an issue where the email option does not work on certain articles. The most common culprit is an apostrophe in the article title, which breaks our legacy code for the email option.

 We've fixed the issue for new themes, but existing customers might still run into this issue. Luckily it's an easy fix!

  1. Go to Settings > Style > Custom HTML > Article to edit the article html template.
  2. Replace this section:
    <a href="#" onclick="javascript:window.location='mailto:?subject=[article("title")]&body=' + window.location;"><i class="fa fa-envelope-o fa-fw"></i></a>
    With this:
    <script>function sendEmail() {var title = '[article("title")]'.replace("'","\'").replace("'", "\'");window.location = 'mailto:?subject=' + title + '&body=' + window.location;}</script><a href="#" onclick="sendEmail()"><i class="fa fa-envelope-o"></i></a>
  3. Save.

Now you should be able to email those articles with apostrophes!