Stacks4Stacks Comment stack question

I would like to add a @willwood CommentStack to a blog that I have behind a firewall. But, the only way that I can see it working is if there’s a way to give the stack some kind of ID so that a Permalink macro could be used. Otherwise, the same comment thread will appear across all blog posts. I’m wondering if this is possible, or if someone has implemented some sort of simple commenting process on TCMS blogs (I am not interested in anything someone has to log into, such as Fb or Discus, since this is an intranet of sorts and behind a firewall). Just a simple way to comment on the relevant blog post.

The database name is the field that makes each commenting stack individual.

If you paste the following code into the Database Name, you can pass a name via browser / query parameter.

'.$_GET['database'].'

Note the single quotes!

CleanShot 2021-08-24 at 16.13.43

Check out this quick example:
https://kitchensink.heiko.codes/comments/?database=database-001
https://kitchensink.heiko.codes/comments/?database=database-002

The database name must be letters and numbers only, similar to a blog page / slug.

Does this help?

[Update] As I wasn’t very clear in my answer: the term “database” was a bad example. We’re looking for an attribute from the the query url that identifies the page. So, according to my answer, you have to look for a query attribute that’s unique for each url / page, like the permalink attribute or sometimes something like article-id or similar, e.g.:

https://www.myawesomeblog.xyz/blog/?permalink=trip-to-las-vegas

Replace “database” from '.$_GET['database'].' with “permalink”, now the stack creates for each page a commenting database file with the name of the permalink.

2 Likes

Thank you, @dripple. I created several duplicate databases on the server and then added the code (exactly as you show it) in the stack; republished and refreshed the blog page a couple of times. It found the first db - but so did all of the other blog pages. That is, I’m not able to differentiate between them. Obviously user-error. Maybe I’m missing a step?

There’s one step missing: the blog usually uses a slug or anything that indicates the blog page to display. That’s the part we need.

If you don’t mind sharing a url so I can have a look if I find something useful?

Yes, absolutely. The site is password-protected, so I will send you a DM. Thank you!

2 Likes

Dave, I quickly checked your blog and will post the solution here so we have a complete thread in case someone else has a similar question:

The missing link is the “permalink” attribute, so the code should read:
'.$_GET['permalink'].'

Looks like this:
CleanShot 2021-08-25 at 13.09.01

This creates for each blog entry a database file for the CommentsStack with the name of the blog page (aka the permalink).

This should do the job.

/heiko

4 Likes

YES, YES, YES!!!

Many thanks, Heiko, this works perfectly! I really appreciate your taking the time to figure out the solution and sharing it with us. All the best, Dave

4 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.