Links in Content Editor Web Part

If you have used SharePoint for a while, you will notice that the Content Editor Web Part, for some reason, stores absolute URLs and not relative URLs. This means that if you move content from one server to the other and there are links in the CEWP pointing to pages within the site, you will have to manually change them (ouch). It seems that the people working on the site had to go through that painful process .

One common workaround is highligheted here which basically talks of having a custom Control Adapter that intercepts the HTML being rendered by the CEWP and converts them to relative URLs. 

Now one thing here is the extra processing on the page render, since it had to go through the adapter. We were focused a lot on performance so we  used a different approach ie. we implelented a event reciever  for the page libraries that had used CEWP and before saving the absolute parts in the URLs were trimmed out.
This might not be a good approach in which the site structure is flexible and people can easily go and create sites, however in the case of an Internet Site where the process is more managed, this would be useful. True there would be a management overhead in that on creating a new site, this event reciever would have to be registered, however since the prime focus is on the end user rather than the content authors we went with this approach for our site.


One comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: