Using Save Site as Template with Publishing Sites – Part 3, Fixing Up the Page Layout Module

The previous posts in this series covered the simple steps necessary to get the sample page layout and sample page into a new solution. It was all pretty simple, but at this point you need to be careful and pay attention. I can tell you from personal experience that if you mess up the page layout’s properties, you can break page editing in your site!

Start by switching to the import solution you created in Part 1 (or open it if necessary) and open the elements.xml file for the page layout in the editor. You will be pulling some, but not all, of this information over to the new solution. I have highlighted the pits you will need.

Switch back to the MyPublishingFeatures solution and edit the elements.xml file for the MyPageLayout feature. Start by editing the Module and File elements so that the Url and Type attributes are correct and so that the File element is not self-closing. The result should look like this:

Next, copy the Property elements highlighted above and paste them into the File element to match the following.

You are almost done with the page layout, but there is one critical step remaining! The Value attribute of the PublishingAssociatedContentType Property is formatted incorrectly. You must edit the value to match the following format:

;#ContentTypeName;#ContentTypeID;#

In this case the Value becomes

 ;#Article Page;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900242457EFB8B24247815D688C526CD44D;#

Save your work. The page layout is done and you are now ready to take care of the publishing page which, unfortunately, is slightly more complicated.

Table of Contents

Using Save Site as Template with Publishing Sites – Introduction

Using Save Site as Template with Publishing Sites – Part 1, Saving the Site and Importing the Solution to Visual Studio

Using Save Site as Template with Publishing Sites – Part 2, Creating the New Custom Visual Studio Solution

Using Save Site as Template with Publishing Sites – Part 3, Fixing Up the Page Layout Module

Using Save Site as Template with Publishing Sites – Part 4, Fixing Up the Publishing Module

Using Save Site as Template with Publishing Sites – Conclusion

Author: Doug Ware