Get current URL in Nunjucks template?

Viewed 2613

Seems like it should be pretty straightforward, but I'm having a really hard time finding an answer.

How do you find the current page's URL within a Nunjucks template?

Something like this would be perfect:

<a href="{{ page.url }}">Some link</a>
2 Answers

depends on attributes of your request obejct, if it's wsgi request from django, I simply print it as {{ request.build_absolute_uri }}

Try something like this: {{ request.headers.referer }},

or this: {{ request.url }}.

Related