Breadcrumbs SiteMapPath and SEO-Friendly Routing

I have a routing setup as follows:

void RegisterRoutes(RouteCollection routes)
{
    routes.MapPageRoute("", "Home", "~/Default.aspx");
    ......
}

I implement patches using the SiteMapPath control:

<asp:SiteMapPath ID="SiteMapPath1" CssClass="breadCrumbs" runat="server">
</asp:SiteMapPath>

The Web.sitemap map is configured as follows:

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
    <siteMapNode url="Home" title="Home"  description="Home">    
        <siteMapNode url="~/About" title="About"  description="About">
            <siteMapNode url="~/History" title="History"  
                description="History" />    
        </siteMapNode>
    </siteMapNode>
</siteMap>

My problem is that when I go to mysite.com instead of mysite.com/default.aspx, the Home breadcrumb node does not appear. What am I missing?

UPDATE

I managed to display the "Home" node by updating the Web.sitemap map as follows:

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
    <siteMapNode url="Home" title="Home"  description="Home">
        <siteMapNode url="~/Default.aspx" title=""  description="" />
        <siteMapNode url="~/About" title="About"  description="About">
            <siteMapNode url="~/History" title="History"  
                description="History" />
        </siteMapNode>
    </siteMapNode>
</siteMap>

The only remaining problem is that the path separator still appears on the mysite.com homepage

Is there a way to programmatically render an invisible separator for the main page? The SiteMapPath control itself is located on the main page.

enter image description here

+3
source share
1

, Sitemap, :

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
    <siteMapNode url="~/" title="Global Site Name or Welcome Message"  description="Home">
        <siteMapNode url="~/Home" title="Home"  description="" />
        <siteMapNode url="~/About" title="About"  description="About">
            <siteMapNode url="~/History" title="History"  
                description="History" />
        </siteMapNode>
    </siteMapNode>
</siteMap>

sitemapdatasource ShowStartingNode="false", , ...

. , global.asax(VB):

RouteTable.Routes.MapPageRoute("Home0", "", "~/Default.aspx", True)
RouteTable.Routes.MapPageRoute("Home1", "Home", "~/Default.aspx", True)

, ...

+1

Source: https://habr.com/ru/post/1794307/


All Articles