Reputation: 3725
Desired output:
You're currently following xx artists
Assuming I'm using Pug in a Django template, how would I achieve that if I don't want to hardcode the URL (which I have named as artists
in my URL), and if the artist count is also a variable?
I can do this:
p You're currently following #{user_artists_count} artists
but how can I make the last part a link to a Django URL with the name artists
?
Upvotes: 0
Views: 266
Reputation: 21
You can use the below syntax to use the {% url %}
django tag in pug templates.
(I put it here for reference, had been searching the last few hours for it.)
p You're currently
- url 'artists' as the_url
a(href=the_url) following #{user_artists_count} artists
Source: https://docs.djangoproject.com/en/2.1/ref/templates/builtins/#url
Upvotes: 0