Search code examples
dotnetnukednn9

DNN - How can I add CDN (cloud) references for Bootstrap / JQuery files?


I have a DotNetNuke (DNN 9.0) website, and I see CSS/JQuery files are referenced as entrees in a *map.XML file, such as below:

  <item key="7d14598udfghjho0348dfdgvt4644" file="" compression="" version="180">
    <files>
      <file name="/Resources/libraries/jQuery/01_09_01/jquery.js" />
      <file name="/Resources/libraries/jQuery-UI/01_11_03/jquery-ui.js" />
    </files>
  </item>

I want to have more control on these references, such as being able to reference cloud(CDN) links instead, for example JQuery provides CDN below:

<script
  src="https://code.jquery.com/ui/1.11.3/jquery-ui.min.js"
  integrity="sha256-xI/qyl9vpwWFOsdaf/9WkG5j/SVasdf1viy8fWwbeE="
  crossorigin="anonymous">
</script>

My problem is I cannot locate anywhere other than map.XML file that is referencing these files, and this XML file doesnot seem to be the right place for CDN references or any modifications because DNN regenerates this file and overrides manual additions.

Your ideas will be appreciated.


Solution

  • It is a bit hidden since DNN 9. Go to Settings >> Extensions, select JavaScript Libraries from the dropdown list, click the pencil next to the JavaScript jQuery library, select the Extension Settings tab and enter the Url in the Custom CDN setting.

    As the Bootstrap library is not included, you have to create it - thanks to Brian Dukes, a lot of popular libraries are already packaged as a DNN install file, so you can go to https://github.com/EngageSoftware/DNN-JavaScript-Libraries, download and install it. Then you can do the same as above.

    If you don't find that it could be that the setting was not there in your DNN 9.0.x version - anyway, this is old and a lot of security issues have been fixed since then, so consider upgrade to a newer version (9.5.0 is current at the moment).

    enter image description here