Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

To avoid adding some static HTML to my custom masterpage, and allow the end-user to easily change it by just changing an HTML file instead of the masterpage, I'm trying to embed a static ContentEditorWebPart to the masterpage.

I've had success by using something like:

<WebPartPages:ContentEditorWebPart webpart="true" runat="server" __WebPartId="{C0503828-714F-4DCA-BE3E-38CDA298D9BD}">
<WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">
<Title>SharePoint Skins Footer</Title>
<FrameType>None</FrameType>
<ID>g_c0503828_714f_4dca_be3e_38cda298d9bd</ID>
<ContentLink xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor">/SiteAssets/Test.html</ContentLink>
<Content xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor"></Content>
</WebPart>
</WebPartPages:ContentEditorWebPart>

However, my issue is that the ContentLink "/SiteAssets/test.html" points to a relative Url. That's fine as long as the user hitting the site with my custom masterpage has at least read permissions on the root SPWeb to access the Site Assets DocLib and pull the test.html file from there.

What I am looking for is to use a relative Url as ContentLink to make the HTML file independent of the root SPWeb and allow each SPWeb to have its own.

So far, I tried to use "../SiteAssets/test.html", "SiteAssets/Test.html" and a couple of other combinations, but all failed under certain conditions, e.g. when hitting a page in "/_layouts" or "/Lists" or "/Forms" (well you get the point).

Since this has to work with SharePoint Foundation 2010/2013 and up in a hosted environment (like Office 365 or any other hosting company which does not use SharePoint Server as hosting platform) I am stuck with avoiding $SPUrl because it is only available in SharePoint Server.

Does anybody have an idea how to get this working inside a Foundation masterpage?

EDIT: And since it has to be accessibility compliant it has to work without relying on client-side JavaScript, so the trick referred at Get site url in ContentEditorWebPart content can't be used.

share|improve this question
add comment

1 Answer

Have you tried using ~site and ~sitecollection tokens?

<ContentLink xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor">~site/SiteAssets/Test.html</ContentLink>
share|improve this answer
    
Excellent point! Will try and report back here. –  Sig Weber Mar 13 '13 at 13:40
    
Been there, tried it. Unfortunately both fail with the usual "Cannot retrieve the URL specified in the Content Link property. For more assistance, contact your site administrator." –  Sig Weber Mar 13 '13 at 14:11
    
Sorry didn't notice you are on SharePoint Foundation. The tokens are part of the Publishing dll which is not present in foundation. –  Vardhaman Deshpande Mar 13 '13 at 15:48
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.