FastComments.com Blog
follow us in feedly
Wed Feb 12 2020 -
...

Using FastComments in Multiple Places On The Same Page

FastComments is flexible. It attaches to a regular element on a page so it works with any web framework.

This means we can have as many threads on a page as we want. For example, here are two threads side-by-side.

How it works

Here's the code that makes this happen. We customize the urlId parameter to make each thread unique. Note that we use ids however you can pass in any DOM element queried in any manner you like.

<script src="https://cdn.fastcomments.com/js/embed-v2.min.js"></script> <div class="widgets"> <div class="widget left" id="fastcomments-widget2"></div> <div class="widget right" id="fastcomments-widget3"></div> </div>

<script> window.FastCommentsUI(document.getElementById('fastcomments-widget2'), { tenantId: 'L177BUDVvSe', urlId: window.location.href + '?cats', headerHTML: '<h1>Discuss Cats</h1>' }); </script> <script> window.FastCommentsUI(document.getElementById('fastcomments-widget3'), { tenantId: 'L177BUDVvSe', urlId: window.location.href + '?dogs', headerHTML: '<h1>Discuss Dogs</h1>' }); </script>