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 have a Page Layout which is used by some Publishing Pages, and uses code-in-front like <%= DateTime.Now %>.

I opened this Page Layout in SharePoint Designer and modified it and saved it, and now it says

Page cannot contain code blocks

My first idea was to manually revert the Page Layout to its previous state (again using SharePoint Designer), but that solved nothing, presumably since the page itself isn't broken.

Then I wanted to delete the Page Layout and re-install it, but that's not possible since it's in use by Publishing Pages. Or is it?

Then I wanted to allow code blocks for this particular page by adding PageParserPaths, but I don't know which VirtualPath my Page Layout has.

How can I repair my Page Layout?

share|improve this question
up vote 5 down vote accepted

Revert to the previously published version?

Unghost the file? ("Revert to Site definition" option in Site Settings).

share|improve this answer
"Reset to Site Definition" did it. Thanks! – ScarePoint Apr 27 '11 at 15:10

Your Answer


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.