When a single test newsletter is sent, Drupal provides me with the expected URL as follows:

{% set foo = url('<current>') %}
<p class="link-to-page">
<a href="{{ foo|render|replace({'simplenews':  ""}) }}">{{ 'You can view this news article in your web browser' }}</a>

Or by using the trim Twig function

But when sending the actual newsletter issue to subscribers, the batch process causes the url(‘current’) to provide a batch url like https://my-site.uk/batch

How can I obtain the one I want (to direct newsletter recipients to the page). Will a preprocess theme function see the same url values as twig or can I reliably capture the node’s real URL there Somehow?

1 Answer 1


This is better!

<p class="link-to-page">
  <a href=" {{ url('entity.node.canonical', {'node': node.id}) }}">
      You can view this news article in your web browser

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.