Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

111
Visualizações
Ignore the scripts for a specific page

I have been trying to make a blog in publii. And let's assume that I made a home page, a Contact Us page and an article page. So I have been trying to implement comments using Disqus. So for that, I have put the code below as custom HTML after every post.

<div id="disqus_thread"></div>
<script>
    (function() { // DON'T EDIT BELOW THIS LINE
    var d = document, s = d.createElement('script');
    s.src = 'https://websitenamehere.com/embed.js';
    s.setAttribute('data-timestamp', +new Date());
    (d.head || d.body).appendChild(s);
    })();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>

So by default this script will run on every post I make, ie it won't run on the home page but will come on the contact us page and article page. I don't need it on the contact us page so is there any HTML code to ignore this footer on the contact us page only?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You could prevent this function to run if the path of the current page meets some criterias. For example, you could edit your script to that :


if(
  !window.location.pathname.startsWith('/contact')
  &&
  !window.location.pathname.startsWith('/about-us')
){

(function() { // DON'T EDIT BELOW THIS LINE
    var d = document, s = d.createElement('script');
    s.src = 'https://websitenamehere.com/embed.js';
    s.setAttribute('data-timestamp', +new Date());
    (d.head || d.body).appendChild(s);
})();

}

Of course you should change /contact and /about-us to the urls used in your website !

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda