3

I have restricted a website to 2 custom page layouts created by me.

But since I did this, the new document button on the Pages Library is not directing me to the create page dialog, where I can select the layout, etc. it is directing me to the standard upload document. Does anyone know what is causing this and how to fix it?

2

I have found this also when changing/adding content types, it still defaults to upload by default.

Check the Content Types on the pages library and remove any which you don't need. Try setting the web part page as the default content type.

If that doesn't work (and this is critical), you could use javascript in a Script web part to redirect the New Document link to create a web part page. This question gives an example for sharepoint 2007.

  • I also thought of adding some javascript hackery, I was expecting a more OOB approach...I cannt add the web part page as the default content type because I want to restrict the content types to only one, the one associated with my custom page layouts. – Luis Dec 2 '13 at 12:34
2

OK So I found the answer, as explained here:

http://msmvps.com/blogs/laflour/archive/2008/05/20/publishing-content-types-and-missed-quot-createpage-aspx-quot-page-in-wcm-sites.aspx

All you have to do is to set the DocumentTemplate property of the content type to:

/_layouts/CreatePage.aspx

so in my case:

var pageCt = list.ContentTypes["MySitePageContentType"];
pageCt.DocumentTemplate ="/_layouts/CreatePage.aspx";
pageCt.Update();

Since I am deploying via a feature event receiver, if you doing it via an xml maniphest:

<ContentType

        ID="0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900<GUID>"
        Name="my Publishing Content Type"
        Group="my Publishing Content Type"
        Description="Content Type inherited from Publishing Page"
        >
        <FieldRefs>
            <FieldRef ID="{<GUID>}" DisplayName="Title" Name="Title" Sealed="TRUE" />
            <FieldRef ID="{<GUID>}" DisplayName="Description" Name="Comments" />
        </FieldRefs>
        <DocumentTemplate TargetName ="/_layouts/CreatePage.aspx"/>

</ContentType>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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