Developer forum

Forum » Templates » Relative path not wanted in styles for SVG logo

Relative path not wanted in styles for SVG logo

Lise T. Pedersen
Reply

I have a template with an SVG-logo, originally black, but it is going to have a "golden gradient", and in the master file I have the styles for this (see attached file) - but when the template is rendered, and I am testing the webpage live, the first style to fill(url(#SVGID_1_) has been added a path to "Files/Templates/Designs/etc..." - and I guess thats why my golden gradient is not working.
In the parsed file, there is no path.

Anyone who can tell me, if there is a way to solve it - or other suggestions on how to make it work?

Thanks in advance,
Lise

 

 

 

 

svg-example.jpg

Replies

 
Aki Ruuskanen
Aki Ruuskanen
Reply

I also have this issue at the moment. 

I have icons defined like this:

background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/.........

But that is being parsed to:

background-image: url(/Files/Templates/Designs/SkanskaMaskin/'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI

/Aki

 

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

It has been registered as a bug. TFS#41210

The parser will ignore anything starting with "@", "<!--@", "http://" or "https://", so a possible workaround is to use variables in razor templates...

<style>
        .test {
            @{ var backgroundImage = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/"; }
            background-image: url(@backgroundImage);
        }
</style>
 
Aki Ruuskanen
Aki Ruuskanen
Reply

Thanks. Almost. 

The parser seems to react to the "url" part anyway but if I put the whole thing in a variable it works. 

var bgImage = "url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/...');
<style>
.test{
background-image: @eyeBg
}
</style>
 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply
This post has been marked as an answer

Hi Aki

The problem TFS#38246 "Relative path not wanted in styles" has now been fixed in version 9.3.6

You are able to find this build in the download section:

http://doc.dynamicweb.com/releases-and-downloads/releases

Please contact Dynamicweb Support if you need any additional help regarding this.

Kind Regards
Dynamicweb Support
Kristian Kirkholt

Votes for this answer: 1

 

You must be logged in to post in the forum