Access Resource Package Assets from Content Widget - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Access Resource Package Assets from Content Widget

  • Access Resource Package Assets from Content Widget
  • 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

  • I, too, would like to know if this is possible.
  • 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