$(document).ready(function() { if ($('body').hasClass('departamento') || $('body').hasClass('categoria') || $('body').hasClass('resultado-busca')) { // Get the current category from the second li on the breadcrumb var currentCategory = $('.bread-crumb ul li').first().next().text(); // Some categories have two words on its name if(currentCategory == 'Acessórios' || currentCategory == 'Ferramentas' || currentCategory == 'Vestuário') { currentCategory += ' - ' + $('.bread-crumb ul li').first().next().next().text(); } // In case we have a collection, set the category name based on it's id if(window.location.href.indexOf('H:147') > -1 || window.location.href.indexOf('/147') > -1) { currentCategory = "Transmissões"; } // Set the page title /* var pageTitle = currentCategory + ' para bike '; */ // This is the list of the filters that shouldn't be listed on the canonical link var filtersBlackList = [ 'formas de fixação:', 'pequenas partes', 'para freios:', 'furos', 'tipos de válvula:', 'tipo da válvula:', 'comprimento da válvula:', 'comprimento:', 'off-set:', 'forma de fixação:', 'uso em correntes:', 'pcd', 'velocidades:', 'quantidade de elos:', 'sistemas de freio:', 'tipos de eixo:', 'furação', 'rotores:', 'adaptadores:', 'medidas', 'material', 'para uso urbano', 'formatos:', 'comprimentos:', 'tecnologias', 'materiais', 'roscas', 'quantidade de coroas', 'combinação das coroas', 'braços', 'medidas dos eixos', 'composição', 'larguras', 'formatos', 'tpi', 'para uso', 'modelo de carrinho', 'modelo', 'sistema', 'diametro', 'espessura', 'eixo', 'trava', 'medida', 'tamanho', 'acompanha', 'material do quadro:', 'tamanho do quadro da bicicleta', 'faixa de preço' ]; // We need to remove the brands filter from some categories var noBrandsCategories = [ 'Adaptadores de Cassete', 'Câmaras', 'Grupos', 'Guias e Esticadores', 'Movimentos', 'Pedais', 'Raios', 'Ferramentas - Bombas', 'Vestuário - Capacetes', 'Vestuário - Sapatilhas' ]; if (noBrandsCategories.indexOf(currentCategory) > -1) { filtersBlackList.push('marca'); } // If we don't have a Acessórios category, we need to include the Cores filter in the black if(currentCategory.indexOf('Acessórios') == -1) { filtersBlackList.push('cores'); } // Check the selected filters $('.search-single-navigator .filtro-ativo').each(function() { var filterName = $(this).parent().prevAll("h5:first").text().toLowerCase() /*********/ /* Title */ /*********/ var pageTitle =""; if (filterName == 'tamanho do aro') { pageTitle += 'Aro ' + $(this).text() + ' '; } else { pageTitle += $(this).text() + ' '; } /*************/ /* Canonical */ /*************/ if (filtersBlackList.indexOf(filterName) > -1) { console.log('caiu na black list -> filterName: ' + filterName); $('html head link[rel=canonical]').remove(); $('html head').append(''); } }); // In case we have a Transmissões category, we always need to se the canonical if(currentCategory == 'Transmissões') { $('html head link[rel=canonical]').remove(); $('html head').append(''); } // Set the page title /* $('html head title').remove(); $('html head').append('