I have a content editor webpart

I am referring a html file to the content link of the webpart

the contentLink looks something like the one below

sites/ImageList/Style Library/Page/ImageList.html

It works fine in my machine but when i deploy the wsp in other machine, its not loading the page as the "sites/ImageList" will be changing

How can i have this working in any machine? The files are there in style library and it works after i manually change it

3 Answers 3


As Pradip has already told the reason for this behaviour I won't repeat it here again. But there are a couple of things you can try.

Have a look at this article, Inconvenient Content Query Web Part and server-relative URLs, which suggests -

Another way to get around this issue is to use a Feature Receiver. After activating the Feature that provisions the .webpart file of the Content Query Web Part with custom XSLT files, it would modify the contents of the .webpart file and replace the tokens with server-relative URL of the current Site Collection.

The aforementioned article also provides code snippet which you can give a try.

You can also look into using URL tokens by changing the code within the Elements.xml file of Content Editor Web Part as below:

<ContentLink xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor">~site/Style Library/Page/ImageList.html</ContentLink>

Please look into the discussions over here and here for more information on using URL tokens in CEWP.

  • stuck with the same issue and this answer is not working now! Commented May 25, 2017 at 11:22

If you enter a URL into the Content Editor Web Part as a relative link, the link converts to an absolute URL when the entry is saved. This automatic conversion can be an issue if you are deploying content from a staging environment to production, where absolute URLs reference the original server's name.

To address this automatic conversion issue,

You will need to edit the Content Editor Web Part on the production server and update the URLs manually.

Read more here.


As per this article, I've:

Put the CEWP HTML in a text file, relative URL included and put it in a document library. Put the link to this text file in the CEWP.

CEWP Content Link

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.