Search code examples
jquerydotnetnuke2sxc

Load JQuery from DNN in 2sxc13


Is there a way to load JQuery library from the DNN install in a razor template without loading external links or relative paths to the file? Something like @include(jquery). Even better if it checks if it is already loaded.


Solution

  • This can be done in 2sxc ;)

    var page = GetService<ToSic.Sxc.Services.IPageService>();
    page.Activate("jQuery");    
    

    See also https://docs.2sxc.org/net-code/razor/services/page-service-activate.html