Add Link To Node In Simplenews Newsletter
When we want to add newsletter feature to our Drupal website, we might end up finding the simplenews module as the solution. But, there is one problem that so many people asked about in the internet. By default, simplenews will send the whole node content in the body of the newsletter e-mail, not the teaser. Ideally, the newsletter e-mail will contain the teaser or trimmed version of the full content with the link to read it online to our website. Unfortunately, there is no built-in option which enable the simplenews to provide the link to the full content in our website.
There are some solutions I found in the internet which require us to override the template of the newsletter e-mail. That solution of course need us to have some programming experiences. In this article, I want to introduce an easier solution, which don't need us to write any code, but still enable us to send the newsletter e-mail containing node teaser with the link to node.
In order to accomplish that, there are three steps we need to do. I assume we are sending the e-mail in plain text format.
- Add the new text field in the content type that we will send as newsletter. Give it the name Read online, then fill its default value to [node:url] token.
- Manage the display of that content type. Expand the custom display setting fieldset then check the Email: Plain option.
- Now, we have a new view mode that can be customized. Choose the new one, the Email: Plain to customize it.
Then we need to choose two fields to be displayed. The trimmed or summary of the Body (the teaser) and the Read online field which we have created before.
After we save that content type, we can test to send the newsletter. The trick to display the link to node is the content of Read online field, which is [node:url] token. That token will be automatically converted into the link to the original node when we send the e-mail.