views:

1711

answers:

2

I have a Sharepoint publishing site with variations. The breadcrumb by default shows this:

Variation Root > English Site > Some Page What I want to display is: "Home" > Some Page, where Home points to the English site root.

Is there a way to achieve this withouth creating a custom server control to do that?

A: 

If you know the exact number of levels you can use a SiteMapPath like:

<asp:SiteMapPath runat="server" ParentLevelsDisplayed="1" />

Otherwise the SiteMapPath always goes direcly agains the SiteMapProvider currently in use and you can probably hook into the rendering of the SiteMapPath a do a check, like:

protected void SiteMapPath_ItemCreated(object sender, SiteMapNodeItemEventArgs e)
{
    if (e.Item.ItemType == SiteMapNodeItemType.Root ||         
       (e.Item.ItemType == SiteMapNodeItemType.PathSeparator && 
        e.Item.ItemIndex == 1))
    {
        e.Item.Visible = false;
    }
}

that will make you SiteMapPath not showing the rootnode (and the first separator).

and if would like your node to display "Home" you can bind against another value, something like:

<asp:SiteMapPath ID="siteMapPath" runat="server"
    Pathseparator="/"
    OnItemCreated="SiteMapPath_ItemCreated">

<NodeTemplate>
    <a href='<%# Eval("url") %>'><%# Eval("description") %></a>
</NodeTemplate>

<CurrentNodeTemplate>
    <%# Eval("title") %>
</CurrentNodeTemplate>    

</asp:SiteMapPath>

if description has a value of "Home" that will be shown.

Johan Leino
A: 

Just recently I have created a couple of new menu controls which address this issue. My controls accept the custom ~Variation/ token as the StartingNode so that you can create a breadcrumb that starts with the home of your variation rather than the root of your Site Collection. You can find more information @ http://blog.mastykarz.nl/templates-based-menu-control-sharepoint/

Waldek Mastykarz - MOSS MVP