0
votes

I'm creating new Site Definitions using this method:

http://weblogs.asp.net/paulballard/archive/2007/04/09/creating-a-custom-sharepoint-2007-portal-site-definition-using-the-portalprovisioningprovider-class.aspx

and when they get created, they're not using the "Title" of the Site as I'd expect, instead they all say "Home".

In my SiteTemplates/customsite/onet.xml file I'm using the following:

<Module Name="LifeWork" Url="$Resources:cmscore,List_Pages_UrlName;" Path="">
      <File Url="default.aspx" Type="GhostableInLibrary" Level="Draft">
        <Property Name="Title" Value="$Resources:cmscore,IPPT_HomeWelcomePage_Title;" />
        <Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/LifeWork.aspx, Life &amp; Work Page Layout" />
        <Property Name="ContentType" Value="LifeWork" />
        <Property Name="PublishingAssociatedContentType" Value=";#NibrLifeWork;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900B92C2841B98136F108;#" />
      </File>
    </Module>

So I see that it's pulling Home from the resource file, but I thought it should also append the Title of the Site into the Title of the page. Is this correct?

2

2 Answers

1
votes

Well it depends how the page is designed. If you look at the page LifeWork.aspx there will be a contentplaceholder for the Title. Based on what value you place there your page will get that value. For example few pages has the

<SharePoint:FieldValue ID="x" FieldName="Title" .......

Some has site name appened to it. Look in that tag you can get what you want.

0
votes

FYI I wound up overriding the ItemCreateEventHandler :

public class ItemCreateEventHandler : SPItemEventReceiver { public override void ItemAdded(SPItemEventProperties properties) { try { SPFile file = properties.ListItem.File; SPWeb web = properties.OpenWeb();

            PublishingWeb pubweb = PublishingWeb.GetPublishingWeb(web);
            if (file.UniqueId == pubweb.DefaultPage.UniqueId)
            {
                if (file.Title != pubweb.Title)
                {
                    file.CheckOut();
                    file.Item["Title"] = pubweb.Title;
                    file.Item.Update();
                    file.CheckIn("");
                }
            }
            web.Dispose();
            pubweb.Close();
        }
        catch { }
    }
}