I have a JSLink file which renders some additional information (e.g. a graph) for a out-of-the-box task list. I want to give anyone in my company the possibility to make use of this JSLink file. Where can I store it to make sure, that it can be used across multiple site collections without having multiple copies of it (e.g. by putting it into every style library)?

I am using a SharePoint 2016 on-premise installation.

  • 1
  • BTW. You don't need JSLink files if you define everything in JS file loaded as a UserCustomAction scriptlink. you then have 1 file (per SiteCollection) May 24, 2017 at 14:48
  • @Danny'365CSI'Engelman I want to alter the default rendering for a view. That is what JSLink was made for. I do not want to do DOM-manipulations afterwards using UserCustomAction.
    – kekub
    May 24, 2017 at 14:58
  • 1
    All JSLink does is load a Javascript file. It doesn't matter if you load that file wit UCA, in the MasterPage or any other way.. All that is required is that the JS file loads before SP renders the view. You can apply your CSR (Client Side Rendering) code anyway you want. JSLink is only one way May 24, 2017 at 15:03
  • It is a view specific JSLink. I can not load it SiteCollection wide.
    – kekub
    May 24, 2017 at 15:19

3 Answers 3


There are couple of options which you can choose one way according to your requirement.


If you have CDN for your organization you can keep all your JS, CSS, Images, and JS Link files in order to share across multiple web applications or site collections.

Site Collection

You can keep in root site collection Style Library or Site Assets library which can be shared across sites under a site collection. It requires copying across site collections to reuse. You can refer the path as follows

~sitecollection/Style Library/JS/jslinkfile.js


You can keep in current site Site Assets library which can be used only on that site. It requires copying across sites in a site collection. You can refer the path as follows.

  • I think CDN is not possible because a token must be used in a on-prem SharePoint environment when adding a JSLink. Site Collection and Site would require a copy of the script at many locations which I wanted to prevent. Thanks for your suggestions!
    – kekub
    May 24, 2017 at 13:36
  • It is not a mandatory to use the token. JS link is nothing but adding a JS file reference to the web part. This can be done in different ways. If the file is locating in the SharePoint site you have to add a token to specify sitecollection or site. The CDN path should work as per my testing. May 24, 2017 at 13:51
  • Do a two-tier approach on-prem, a ~sitecollection/.JS file that is nothing but a loader for you files from a CDN May 24, 2017 at 14:47
  • Does the CDN path work in an on-premise or in a SharePoint Online environment? I just tested the CDN approach and it does not work - it does not even load the JS Link file.
    – kekub
    May 24, 2017 at 14:52
  • @Danny'365CSI'Engelman I still need to place one file in every site collection ... I think it should be possible to have this w/o doing all these workarounds. Even _layouts seems like a better solution.
    – kekub
    May 24, 2017 at 14:54

I guess storing JSLink is not required to be any specific place, you can store it on any Site Collection's Site Asset or Document Library or Style Library and record the url of the file.

This url you can share among your company so that every one can use it.

Still if you have any top level site collection, then storing on top level site collection will make more sense.

But you have to make sure that every user has access to the site collection where you will keep the JSLink file.

  • 1
    I think this does not work due to the restriction that a JSLink file needs to have a token like ~siteCollection in its url.
    – kekub
    May 24, 2017 at 12:45

Place it in _Layouts folder and use it across in SharePoint Farm.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.