SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm creating a content editor web part that needs to point to the site collection root. Currently, for it's "Content Link" URL field, I have ../../SiteAssets/js/jquery-rotator/slider.txt but this is inconvenient because if I'm in a publishing page such as /Pages/MyFolder/page.aspx, the path will have to be changed.

Is there a way to provide a path that always points to the site collection root's SiteAssets folder? Thanks.

share|improve this question
Since it's custom, can't you just use SPContent.Current.Site.RootWeb.Url + "/" + ContentLink? – Daniel Ziga Oct 21 '11 at 8:01
Thanks, Ziga. Actually, it's the built-in CEWP, but I'm setting it up the way I want, exporting it, and then saving it to the Web Part Gallery. – Alex C Oct 21 '11 at 8:06
Try inserting this <% $SPUrl:~SiteCollection/ContentLink_Here %> – Daniel Ziga Oct 21 '11 at 8:39
<% $SPUrl:~SiteCollection/ContentLink_Here %> will not work. THis is only avaialble in master pages. CEWP does not support this syntax. – Clem Oct 2 '13 at 11:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.