Blog » Updated Breadcrumb Post Tip

Updated Breadcrumb Post Tip

In the blog posting entitled SEO And ASPDotNetStorefront, I presented a way to modify the breadcrumbs automatically created in ASPDotNetStorefront. Well, it appears that I left out one potential way that the breadcrumbs could be presented.

When a top level entity entity (Section, Category, Genre, etc) are displayed the top level is wrapped in a span tag with a class of SectionTitleText. Unfortunately, given my earlier code, this will end up presenting the Section_Title in the same size text rather than the size defined in your H1 tag since H1 tags would end up around the previously mentioned span.

Instead of :

if (SectionTitle.LastIndexOf(sep) == -1) // if there is no arrows in bread crumb
    s = s.Replace("(!SECTION_TITLE!)", String.Format("<h1>{0}</h1>",
        SectionTitle));
else

I now use:
if (SectionTitle.LastIndexOf(sep) == -1) // if there is no arrows in bread crumb
    if (SectionTitle.Contains("<span class=\"SectionTitleText\">")) // This is the root of an entity so strip off this span tag
    {
        tmpS = SectionTitle.Replace("<span class=\"SectionTitleText\">", "");
        tmpS = tmpS.Replace("</span>", "");
        s = s.Replace("(!SECTION_TITLE!)", String.Format("<h1>{0}</h1>",
            tmpS));
    }
    else // this is some other thipe of page
        s = s.Replace("(!SECTION_TITLE!)", String.Format("<h1>{0}</h1>",
            SectionTitle));
elseā€¦

This will trap instances of the SectionTitleText span and removes them from the SectionTitle (if found) before doing the token replacement.

Michael Gibbs
Stalk Me...
Latest posts by Michael Gibbs (see all)