Javascript or dynamically generated Breadcrumbs and microdata markup for rich snippets

Discussion in 'Microdata' started by pfeinstein, Feb 23, 2013.

  1. #1
    Im grappling with the following issue. I'm working on a website with about 700 pages, and use dynamically generated breadcrumbs. I now want to mark-up the breakcrumbs with Microdata. This is in the context of rich snippets for Google.

    So, I'm wondering if anyone has experience with Mircodata markup format for dynamically (javascript)generated breadcrumbs.

    I use this in the header:

    <script language="JavaScript">function breadcrumbs(){sURL=new String;bits=new Object;var x=0;var stop=0;var output="<div class=topnav><strong>&nbsp;You are here: </strong><A HREF=/>Home</A> &raquo; ";sURL=location.href;sURL=sURL.slice(8,sURL.length);chunkStart=sURL.indexOf("/");sURL=sURL.slice(chunkStart+1,sURL.length)
    while(!stop){chunkStart=sURL.indexOf("/");if(chunkStart!=-1){bits[x]=sURL.slice(0,chunkStart)
    sURL=sURL.slice(chunkStart+1,sURL.length);}else{stop=1;}
    x++;}
    for(var i in bits){output+="<A HREF=\"";for(y=1;y<x-i;y++){output+="../";}
    output+=bits+"/\">"+clean(bits)+"</A> &raquo; ";}
    document.write(output+document.title);document.write("</div>");}
    replaceList={'-':' ','2':'2','0':'0'};function clean(arg){out=arg;for(var n in replaceList){while(out.indexOf(n)!=-1){after=out.substring(0,out.indexOf(n))+replaceList[n]+out.substring(out.indexOf(n)+1,out.length);out=after;}}
    return out;}</script>


    And then this in the body:
    <SCRIPT LANGUAGE="JavaScript" TYPE='text/javascript'>breadcrumbs()</SCRIPT>

    Can i mark this up in Mircodata format for rich snippets?
     
    pfeinstein, Feb 23, 2013 IP