jacobwb / hashover-next

This branch will be HashOver 2.0
GNU Affero General Public License v3.0
420 stars 87 forks source link

Dynamic pages differentiated by query string #246

Closed ghost closed 5 years ago

ghost commented 6 years ago

I have a bunch of pages that are dynamically generated at the same base URL, with differing query strings. I'd like each to have its own comments independent of the others. How can I do this?

My best guess is that I have to do something along the lines of the "multiple comment sections on a page" thing, and then generate different pseudo-URLs to specify as the "URL" of the page when invoking the Javascript. Is that the right thing to do?

More generally, is there any real installation documentation for 2.0 at all? All I've been able to find is outdated instructions for 1.0, which make frequent references to files that no longer exist, and some (but not complete) notes in the changelog about how to set up some 2.0-specific features but not the system itself.

jacobwb commented 5 years ago

It definitely sounds like you are on the right track.

However, I would need to know more about how your website works to really say for sure. Do you have a page on your website using HashOver that you can link me to?

Making some guesses:

  1. The dynamically generated content should return/include an element you want the HashOver comments to appear in, like <div id="comments"></div>.

  2. You should have a callback function defined that lets you respond to the dynamically generated content being placed on the page.

Assuming those two things are true, you should be able to instantiate HashOver manually in the callback to get the comments back on the page after the content changes.

Something like this...

var hashover = new HashOver ('comments', {
    url: window.location.href,
    title: document.title
}, 1);

This code will re-create the first instance, which is what you want if you are replacing the content and you want the page to act like it changed normally. However, if you want multiple threads on the page at a time without them conflicting with each other, simply remove the , 1 on the end there.

I hope this helps, if not, I will need more details.

ghost commented 5 years ago

I think this may be a non-issue; subsequent to submitting it I've found that HashOver already automatically uses URL query parameters as part of the "URL" that identifies a comment thread. In the other direction there's a config setting for ignoring specific parameters, and any not listed are included. I'd actually prefer to do it the other way around, since the blacklist approach requires me to predict every parameter that might someday be used, but that's not a big deal.

Closing the issue because it seems solved, but if you want an example of the kind of page I had in mind, see http://audio.northcoastsynthesis.com/index.php?t=japari. With a different "t" parameter that would be a different page and should have a separate comment thread.