Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

109
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!