Link a file to CEWP that lives in another site collection
-
16-12-2020 - |
Вопрос
I'm creating a Page that contains a CEWP which will link to an HTML file.
The plan is to template that site/page and use it across multiple sites and collections.
I want to link the HTML from 1 location so if we need to make an update across all sites, it can be done from said 1 location.
However, there's a new site collection created after a certain threshold so the link can't be in that path. For example:
mysite.com/projects/1/pro-1
mysite.com/projects/1/pro-2
mysite.com/projects/2/pro-3
mysite.com/projects/2/pro-4
mysite.com/projects/n/pro-5
mysite.com/projects/n/pro-n
Given this structure, the HTML file that the CEWP link to cannot be on /projects/1-n
I want to create something like mysites.com/cdn/home/SiteAssets/custom.html
and use that link across all those sites above to link to the CEWP and make changes in one place.
Any suggestions?
Решение
SharePoint has the ability to a create a ContentTypeHub
The name is totally wrong, as it can do much more than just manage ContentTypes centrally
Basically it is a Site Collection where all users have access to
and you can store any files you want in a Document Library on that ContentTypeHub
So you can use it as your Company CDN (Content Delivery Network)
http://sharepointpals.com/post/An-introduction-to-Content-Type-Hub-in-SharePoint-Office-365
If you mean your filenames are changing, an option might to to load your JS file dynamically with: