souramoo / commentoplusplus

Commento with out of the box patches and updates to add useful features and fixes. Also with one-click deploy to Heroku so you can get up and running fast.
MIT License
391 stars 63 forks source link

Help displaying multiple comment boxes on single page #68

Open ParetoOptimalDev opened 2 years ago

ParetoOptimalDev commented 2 years ago

I tried doing this:

<div class="bl-section">
    <h4>Comments</h4>
    <div class="backlinks">
      <script defer data-id-root="{{ anchorize .RelPermalink }}" data-page-id="{{ anchorize .RelPermalink }}" data-auto-init="false" src="https://cdn.commento.io/js/commento.js"></script>
      <a href="#" onclick="javascript:window.commento.main()">View/Make Comment</a>
      <div id="commento"></div>
      <div id="{{ anchorize .RelPermalink }}"></div>
    </div>
  </div>

And the right unique ids show up on my site when a new link is loaded on the same page, but only one comment box is displayed. Here's an example that loads 3 "pages" in the same page with commento forms that have different "data-id-root" values:

https://www.paretooptimal.dev/nixos/?stackedNotes=..%2Fnixos-configuration%2F&stackedNotes=..%2Fpackage-management-and-configuration-in-emacs%2F

I found the PR adding reinit and this repo from there.

If I deploy an instance to Heroku should it fix my problem or is more needed?

Edit: Maybe yes, because when I click those links the comment boxes load in the initial div. I've been debugging this for a while, so wanted some confidence before going down yet another path :smile: