Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Dear Drupal Community,
I am hoping that there is a simple way to add a "View Email in Browser" in any newsletter sent via Simplenews. I'd like folks to be able to view newsletters in their browser and also forward the link to others and post on other sites.
Asking too much or is it easy-peasy? Can someone let me know if I need to repost somewhere else for support?
Thanks,
BN
Comments
Comment #1
Ujin CreditAttribution: Ujin commentedI couldn't find this out of box. But as alternative solution you can create views page with path like newsletter/% argument nid, from url, and output it content. After this in your theme create tpl file like page--newsletter.tpl.php (for drupal 7 ) or page-newsletter.tpl.php (drupal 6) and put there just html you need. And in your email add link like newsletter/10.
May be somebody know better solution?
Comment #2
Marko B CreditAttribution: Marko B commentedNothing is easy peasy with newsletters. As Ujin suggested, build a view or if your NL is simple, just point your users to a node you created when you did your NL issue as there is always one when you create new NL.
Comment #2.0
Marko B CreditAttribution: Marko B commentedVerifying post
Comment #3
maki3000 CreditAttribution: maki3000 commenteddisclaimer: there are many ways to setup and theme a simplenews newsletter. here, i'm talking about having a simplenews-newsletter-body.tpl.php file in my themes templates folder..
i got the same problem here. i want to have a "View in browser" inside my simplenews-newsletter-body.tpl.php. the only thing i managed to have is:
(i'm in drupal7 btw.)
i have a
global $base_url;
in top of the file. and then link tothis works. so a user can open the NL in the browser. but i find it not really nice to have e.g. ".../node/76" in the url. i wanted to have the URL-Alias of the NL in the URL, but didn't manage to find out, how to retrieve it out of a token or the $build['#node']
in drupal6 it was an easy thing. it worked with a token just like that:
Comment #4
maki3000 CreditAttribution: maki3000 commentedi got it: just
[node:url]
did it!Comment #5
Anonymous (not verified) CreditAttribution: Anonymous commentedmaki3000, you have salvaged my newsletter!
I have been struggling for days to get a Read Online link on the Simplenews Newsletter.
I have looked everywhere and couldn't find anything.
Here is the code that worked for me in the end:
Read the full post
Comment #6
sander-martijn CreditAttribution: sander-martijn commentedThank you maki3000! Took me hours of reading through and trying out other suggestions that didn't work, and turns out to be such a simple solution!
I love drupal. I hate the lack of good documentation.
Comment #7
robcarrFor those confused... insert the line
Into simplenews-newsletter-footer.tpl.php (which you will have copied into your own theme).
Comment #8
marco.staub CreditAttribution: marco.staub commentedFor those who wanted to do that in Drupal 9:
Copy modules/contrib/simplenews/templates/simplenews-newsletter-body.html.twig to your theme and edit it, e.g.:
(Maybe there is a better Attribute than node.id, e.g. the full url, but this will do it)