By default code blocks are not allowed on Master pages or Page layouts. You have to allow them in web.config using the following code: <pageparserpaths> <pageparserpath virtualpath="/_catalogs/masterpage/*" compilationmode="Always" allowserversidescript="true" includesubfolders="true".> </pageparserpaths> **Update: You asked if there is another way to get just the value out of the page content type field?** You can use the code below to get value out of page Content Type field for e.g. name of field is `YourContentTypeFieldName` From code behind, the code will look like following: string valueoffield = (string)SPContext.Current.ListItem["YourContentTypeFieldName"]; From ASPX page, code will look like. Note: you must have URL field <a href='<%=GetURLFieldValue("YourContentTypeFieldName") %>' rel="test" title="Test"> </a>