Salman B
Salman B

Reputation: 148

django "static" tag doesn't work with svg

I am using an SVG with a href of

/static/portfolios/trillio/img/sprite.svg#icon-chat

that works just fine but when I use:

{% static 'portfolios/trillio/img/sprite.svg#icon-chat' %}

the SVG doesnt' show, but the browser console doesn't show any error, the output for the static is this:

/static/portfolios/trillio/img/sprite.svg%23icon-chat

is it the %23 that's making a difference and if so how do I fix that?

Upvotes: 0

Views: 267

Answers (1)

user16100470
user16100470

Reputation:

The problem is the '#' is getting converted to a URL code.

So you can instead put the #icon-chat outside of the code block.

Like this: {% static 'portfolios/trillio/img/sprite.svg' %}#icon-chat

Upvotes: 3

Related Questions