none
Problems with a publishing site custom WebTemplate

    คำถาม

  • Hi, 

    I am creating a custom webtemplate and am basing it on the OOTB blankinternet template id 53.

    See the bottom of my post for my code:

    My WebTemplate deploys fine and when I create a site collection it appears to work however I get a 404 when I view the root site collection. If I add _layouts/settings.aspx I can see the settings page and so the site is definitely created. 

    My guess is that I am missing some custom welcome pages. Can someone please help me understand what I must do to avoid getting 404 errors? I want to have all the OOTB page layouts available to my publishing pages also.

    ONET.XML

    <?xml version="1.0" encoding="utf-8" ?>
    <!-- _lcid="1033" _version="12.0.2220" _dal="1" -->
    <!-- _LocalBinding -->
    <Project Revision="3" Title="$Resources:cmscore,PublishingSiteWebName;" ListDir="Lists" xmlns:ows="Microsoft SharePoint" UIVersion="4">
      <NavBars>
        <NavBar Name="SharePoint Top Navbar" ID="1002">
        </NavBar>
      </NavBars>
      <ListTemplates />
      <DocumentTemplates />
      <Configurations>
        <Configuration ID="-1" Name="NewWeb"/>
        <Configuration ID="0" Name="BLANKINTERNET">
          <SiteFeatures>
            <!-- Workflow Features -->
    
            <!-- Workflow Expiration -->
            <Feature ID="C85E5759-F323-4EFB-B548-443D2216EFB5" />
    
            <!-- DLC Workflows -->
            <Feature ID="0AF5989A-3AEA-4519-8AB0-85D91ABE39FF" />
    
            <!-- "A44D2AA3-AFFC-4d58-8DB4-F4A3AF053188" -->
            <Feature ID="A44D2AA3-AFFC-4d58-8DB4-F4A3AF053188" />
    
            <Feature ID="A392DA98-270B-4e85-9769-04C0FDE267AA">
              <!-- PublishingPrerequisites -->
            </Feature>
            <Feature ID="7C637B23-06C4-472d-9A9A-7C175762C5C4">
              <!-- ViewFormPagesLockDown -->
            </Feature>
            <Feature ID="AEBC918D-B20F-4a11-A1DB-9ED84D79C87E">
              <!-- PublishingResources -->
              <Properties xmlns="http://schemas.microsoft.com/sharepoint/">
                <Property Key="AllowRss" Value="false"/>
                <Property Key="SimplePublishing" Value="false" />
              </Properties>
            </Feature>
    
            <Feature ID="F6924D36-2FA8-4f0b-B16D-06B7250180FA">
              <!-- Office SharePoint Server Publishing -->
            </Feature>
          </SiteFeatures>
          <WebFeatures>
            <!-- Include the common WSSListTemplateFeatures used by CMS -->
            <Feature ID="00BFEA71-DE22-43B2-A848-C05709900100" > </Feature>
            <Feature ID="00BFEA71-E717-4E80-AA17-D0C71B360101" > </Feature>
            <Feature ID="00BFEA71-52D4-45B3-B544-B1C71B620109" > </Feature>
            <Feature ID="00BFEA71-A83E-497E-9BA0-7A5C597D0107" > </Feature>
            <Feature ID="00BFEA71-4EA5-48D4-A4AD-305CF7030140" > </Feature>
            <Feature ID="00BFEA71-F600-43F6-A895-40C0DE7B0117" > </Feature>
            <Feature ID="22A9EF51-737B-4ff2-9346-694633FE4416">
              <!-- Publishing -->
              <Properties xmlns="http://schemas.microsoft.com/sharepoint/">
                <Property Key="ChromeMasterUrl" Value="~SiteCollection/_catalogs/masterpage/nightandday.master"/>
                <Property Key="WelcomePageUrl" Value="$Resources:osrvcore,List_Pages_UrlName;/default.aspx"/>
                <Property Key="PagesListUrl" Value=""/>
                <Property Key="AvailableWebTemplates" Value="*-BLANKINTERNET#2;*-ENTERWIKI#0"/>
                <Property Key="AvailablePageLayouts" Value=""/>
                <Property Key="AlternateCssUrl" Value="" />
                <Property Key="SimplePublishing" Value="false" />
              </Properties>
            </Feature>
            <Feature ID="541F5F57-C847-4e16-B59A-B31E90E6F9EA">
              <!-- Per-Web Portal Navigation Properties-->
              <Properties xmlns="http://schemas.microsoft.com/sharepoint/">
                <Property Key="InheritGlobalNavigation" Value="true"/>
                <Property Key="IncludeSubSites" Value="true"/>
                <Property Key="IncludePages" Value="false"/>
              </Properties>
            </Feature>
            <Feature ID="94C94CA6-B32F-4da9-A9E3-1F3D343D7ECB">
              <!-- Office SharePoint Server Publishing -->
            </Feature>
          </WebFeatures>
          <Modules />
        </Configuration>
      </Configurations>
      <Modules />
    </Project>


    Elements.xml includes the following:

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
      <WebTemplate BaseConfigurationID="0"
       BaseTemplateID="53"
       BaseTemplateName="BLANKINTERNET"
    ...
    ...
    ...

    Am I missing some of the important sections that would have been present in the <Module> tags? 
    • แก้ไขโดย Speedbird85 13 เมษายน 2555 14:24
    13 เมษายน 2555 14:16

ตอบทั้งหมด

  • I have copied some code into a module and added it as part of the feature. By specifying the feature GUID in my webtemplate onet.xml I have managed to get something working. 

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
      <Module Name="Home" Url="$Resources:osrvcore,List_Pages_UrlName;" Path="">
        <File Path="IntranetWelcomePage\default.aspx" Url="default.aspx" Type="GhostableInLibrary" >
          <Property Name="Title" Value="$Resources:cmscore,IPPT_HomeWelcomePage_Title;" />
          <Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/WelcomeSplash.aspx, $Resources:cmscore,PageLayout_WelcomeSplash_Title;" />
          <Property Name="ContentType" Value="$Resources:cmscore,contenttype_welcomepage_name;" />
          <Property Name="PublishingPageImage" Value="&lt;img border=&quot;1&quot; hspace=&quot;0&quot; src=&quot;~SiteCollection/SiteCollectionImages/home.jpg&quot; vspace=&quot;0&quot; style=&quot;margin-right:-6px&quot; alt=&quot;&quot;&gt;" />
          <Property Name="SummaryLinks" Value="&lt;div title=&quot;_schemaversion&quot; id=&quot;_3&quot;&gt; &lt;div title=&quot;_links&quot;&gt; &lt;div title=&quot;_link&quot;&gt; &lt;span title=&quot;_title&quot;&gt;$Resources:cmscore,IPPT_HelpLinks_EnableAnonymous_Text;&lt;/span&gt;   &lt;span title=&quot;_description&quot;&gt;$Resources:cmscore,IPPT_HelpLinks_EnableAnonymous_Description;&lt;/span&gt;   &lt;span title=&quot;_linkurl&quot;&gt;    &lt;a href=&quot;~SiteCollection/_layouts/setanon.aspx&quot;&gt;~SiteCollection/_layouts/setanon.aspx&lt;/a&gt;   &lt;/span&gt;   &lt;span title=&quot;_style&quot;&gt;Default&lt;/span&gt;   &lt;span title=&quot;_order&quot;&gt;1&lt;/span&gt;   &lt;span title=&quot;_begincolumn&quot;&gt;True&lt;/span&gt;  &lt;/div&gt;  &lt;div title=&quot;_link&quot;&gt;   &lt;span title=&quot;_title&quot;&gt;$Resources:cmscore,IPPT_HelpLinks_ManageNavigation_Text;&lt;/span&gt;   &lt;span title=&quot;_description&quot;&gt;$Resources:cmscore,IPPT_HelpLinks_ManageNavigation_Description;&lt;/span&gt;   &lt;span title=&quot;_linkurl&quot;&gt;    &lt;a href=&quot;~SiteCollection/_layouts/areanavigationsettings.aspx&quot;&gt;~SiteCollection/_layouts/areanavigationsettings.aspx&lt;/a&gt;   &lt;/span&gt;   &lt;span title=&quot;_style&quot;&gt;Default&lt;/span&gt;   &lt;span title=&quot;_order&quot;&gt;2&lt;/span&gt;   &lt;span title=&quot;_begincolumn&quot;&gt;False&lt;/span&gt;  &lt;/div&gt;  &lt;div title=&quot;_link&quot;&gt;   &lt;span title=&quot;_title&quot;&gt;$Resources:cmscore,IPPT_HelpLinks_GoToMasterPageGallery_Text;&lt;/span&gt;   &lt;span title=&quot;_description&quot;&gt;$Resources:cmscore,IPPT_HelpLinks_GoToMasterPageGallery_Description;&lt;/span&gt;   &lt;span title=&quot;_linkurl&quot;&gt;    &lt;a href=&quot;~SiteCollection/_catalogs/masterpage/Forms/AllItems.aspx&quot;&gt;~SiteCollection/_catalogs/masterpage/Forms/AllItems.aspx&lt;/a&gt;   &lt;/span&gt;   &lt;span title=&quot;_style&quot;&gt;Default&lt;/span&gt;   &lt;span title=&quot;_order&quot;&gt;3&lt;/span&gt;   &lt;span title=&quot;_begincolumn&quot;&gt;False&lt;/span&gt;  &lt;/div&gt;  &lt;div title=&quot;_link&quot;&gt;   &lt;span title=&quot;_title&quot;&gt;$Resources:cmscore,IPPT_HelpLinks_ManageContent_Text;&lt;/span&gt;   &lt;span title=&quot;_description&quot;&gt;$Resources:cmscore,IPPT_HelpLinks_ManageContent_Description;&lt;/span&gt;   &lt;span title=&quot;_linkurl&quot;&gt;    &lt;a href=&quot;~SiteCollection/_layouts/sitemanager.aspx&quot;&gt;~SiteCollection/_layouts/sitemanager.aspx&lt;/a&gt;   &lt;/span&gt;   &lt;span title=&quot;_style&quot;&gt;Default&lt;/span&gt;   &lt;span title=&quot;_order&quot;&gt;4&lt;/span&gt;   &lt;span title=&quot;_begincolumn&quot;&gt;False&lt;/span&gt;  &lt;/div&gt;  &lt;div title=&quot;_link&quot;&gt;   &lt;span title=&quot;_title&quot;&gt;$Resources:cmscore,IPPT_HelpLinks_SetupMLS_Text;&lt;/span&gt;   &lt;span title=&quot;_description&quot;&gt;$Resources:cmscore,IPPT_HelpLinks_SetupMLS_Description;&lt;/span&gt;   &lt;span title=&quot;_linkurl&quot;&gt;    &lt;a href=&quot;~SiteCollection/_layouts/VariationSettings.aspx&quot;&gt;~SiteCollection/_layouts/VariationSettings.aspx&lt;/a&gt;   &lt;/span&gt;   &lt;span title=&quot;_style&quot;&gt;Default&lt;/span&gt;   &lt;span title=&quot;_order&quot;&gt;5&lt;/span&gt;   &lt;span title=&quot;_begincolumn&quot;&gt;False&lt;/span&gt;  &lt;/div&gt;  &lt;div title=&quot;_link&quot;&gt; &lt;span title=&quot;_title&quot;&gt;$Resources:cmscore,IPPT_HelpLinks_AddUsers_Text;&lt;/span&gt;   &lt;span title=&quot;_description&quot;&gt;$Resources:cmscore,IPPT_HelpLinks_AddUsers_Description;&lt;/span&gt;   &lt;span title=&quot;_linkurl&quot;&gt;    &lt;a href=&quot;~SiteCollection/_layouts/groups.aspx&quot;&gt;~SiteCollection//_layouts/groups.aspx&lt;/a&gt;   &lt;/span&gt;   &lt;span title=&quot;_style&quot;&gt;Default&lt;/span&gt;   &lt;span title=&quot;_order&quot;&gt;1&lt;/span&gt;   &lt;span title=&quot;_begincolumn&quot;&gt;True&lt;/span&gt;  &lt;/div&gt; &lt;/div&gt; &lt;div title=&quot;_view&quot;&gt;  &lt;span title=&quot;_columns&quot;&gt;1&lt;/span&gt;  &lt;span title=&quot;_linkstyle&quot;&gt;&lt;/span&gt;  &lt;span title=&quot;_groupstyle&quot;&gt;&lt;/span&gt; &lt;/div&gt;&lt;/div&gt;" />
        </File>
      </Module>
    </Elements>

    This line was the problem:

    <File Path="IntranetWelcomePage\default.aspx" Url="default.aspx" Type="GhostableInLibrary" >

    I had to add the Path property otherwise it couldn't find the file.

    Now all I need to know is how to stop the webtemplate from creating a search page for me.

    Thanks


    13 เมษายน 2555 16:02
  • I believe I am slowly making progress. I have changed my webtemplate to be based off the team site instead so that has done away with the 'Press Releases' and 'Search' sites being created by default.

    Now all I need to do is work out how to hide certain elements programmatically from my top navigation.

    13 เมษายน 2555 20:15