0

I have a html file in the style library which I am loading onto a content editor webpart using content link

Currently i have used,

/sites/sitename/style library/html/file.htm

But here the sitename is hard coded, and it will not work when exported to other site collections.

I also thought about using

../style library/html/file.htm

But this might not work for pages in subsites or pages hosted in sub folders in a document library

Is there a more generic way to point to style library of site collection?

something like ~sitecollection

1 Answer 1

2

JSLink URLs and Tokens

When you are constructing your JSLink URL there are a number of tokens you can take advantage of:

  1. ~site – reference to the current SharePoint site (or “Web”)
  2. ~sitecollection – reference to the current SharePoint site collection (or “Site”)
  3. ~layouts – version specific reference to the web application Layouts folder (so it will automatically swap out /_layouts/14 or /_layouts/15 for you)
  4. ~sitecollectionlayouts – reference to the layouts folder in the current site collection (e.g. /sites/team/_layouts/15)
  5. ~sitelayouts – reference to the layouts folder in the current site (e.g. /sites/teams/subsite/_layouts/15)

Overview, URL Tokens and Applying JSLink to objects

2

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.