Add Content Editor Web Part into Site Template

In Onet.xml, find the module(s) that need to have a content editor web part and add the following:

<AllUsersWebPart WebPartZoneID="Left" WebPartOrder="1">
          <WebPart xmlns:xsi="" xmlns:xsd="" xmlns="">
            <Title>My Web part</Title>
            <Description>Say Hello Web Part</Description>
            <Assembly>Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
            <ContentLink xmlns="" />
            <Content xmlns="">

                function SayHello() 
                      //all done 


            <PartStorage xmlns="" />


Note some characters need to be encoded.

In case a web part is broken, use contents=1 query string, for example: http://myurladdress/default.aspx?contents=1. This will show a list of all the web parts on the page.

Cheers 🙂