I have some Javascript/CSR that is used on multiple site collections. Is there a way to share this across site collections instead of having the same code published in multiple sites?


Best is to investigate the ContentType Hub, a SiteCollection for storing (besides ContentTypes) any content you want to share

With JSLink you can reference files in any other Site Collection with a absolute URL, just remember the User needs read access

On Office365 you can reference files from any location

Update #1

And.. On Prem... SharePoint runs on your IIS server, so you can move your scripts outside of SharePoint onto another IIS WebSite instance eg. https://scripts.[yourdomain].com

| improve this answer | |

If you don't have a content type hub provisioned or available, another option is to utilize a Site Assets library (or Style Library) in a site collection everyone has access to. This could be your root site collection or your search site collection.

You could create your own script center site collection where you (and others) could store scripts usable by everyone.

The key aspect, as Danny mentions, is storing it in a library that everyone has read access to.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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