Is it possible to work with breadcrumbs with wix code? If it is possible someone could help me with this piece of code so that it works in wixcode. I'm not getting adptar with the wixcode elements needed for it to work.
var breadcrumb={main:[{"text":'Main',"link":'/','class':'active'}],element:'ol',class:'breadcrumb',lastClass:'current-bread',exclude:['#',''],write:true,build:function(){var currentUrl=location.href.split('/').slice(3);var breads=[];var output='';for(var i=0;i<this.main.length;i++){var text=this.main[i].text;var link=this.main[i].link;var cls=this.main[i].class;breads.push({"text":text,"link":link,'class':cls});}for(var i=0;i<currentUrl.length;i++){var text=currentUrl[i];text=text[0].toUpperCase()+text.substring(1);var link='/'+currentUrl.slice(0,i+1).join('/');breads.push({"text":text,"link":link,'class':' '});}output+='<'+this.element+' class="'+this.class+'">';var breadLen=breads.length;for(var j=0;j<breadLen-1;j++){if(this.exclude.indexOf(breads[j].text)==-1){output+='<li class="'+breads[j].class+'"><a href="'+breads[j].link+'">'+breads[j].text+'</a></li>';}}output+='<li class="'+this.lastClass+'"><a href="'+breads[breadLen-1].link+'">'+breads[breadLen-1].text+'</a></li>';output+='</'+this.element+'>';if(this.write==true){document.write(output);}return output;}};
Ah! Thank you so much, I'll try that.
Hi,
You can create a dynamic page, have a collection with all the relevant HTML code, and use postMessage to inject the HTML code to the HTML component. You can find an example of a similar scenario here.
Best,
Tal.
Yes I added the html component but I would need to have a page for each category and could not work with datacolections. So, it's not a problem to have a page for each category, I would only need to duplicate the pages, I need to know if this affects the loading speed. The wix says there are no page limits but is there a relation of the number of pages to the speed of the site? I've already asked this question here in the Forum and no one answered me, I also did it in the Wix Brazil customer center, but I received as a response a text copied and pasted meaninglessly with what I had asked. Would you know to answer me?
You can use the HTML component to add this code.