Access Resource Package Assets from Content Widget

Posted by Community Admin on 05-Aug-2018 16:50

Access Resource Package Assets from Content Widget

All Replies

Posted by Community Admin on 11-Jun-2015 00:00

Hello,

I'm wanting to access images within my resource package from the html inside of a content widget on my page. Is this possible? It appears Razor syntax does not get rendered so I cannot use one of these statements:

 

@Url.WidgetContent("~/ResourcePackages/MyResourcePackage/image/whatever.jpg")

 

I'm hoping I don't have to add these images to the SiteFinity Library just so I can access them.

 

Thanks,

Mike

Posted by Community Admin on 20-Nov-2015 00:00

I, too, would like to know if this is possible.

Posted by Community Admin on 20-Nov-2015 00:00

Hello Mike,


Images can be accessed from the file location from the HTML inside of a Content widget with the following code:

<img src="/ResourcePackages/MyResourcePackage/image/whatever.jpg" />

It is not possible to use the Html Helpers inside the editor of the Content Block as it uses @Html.Raw method to return the content.

Structure of the MVC Content Block can be found here: https://github.com/Sitefinity/feather-widgets/blob/master/Telerik.Sitefinity.Frontend.ContentBlock/Mvc/Views/ContentBlock/Default.cshtml.


Regards,
Arnob Makhlaqur
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

This thread is closed