htmly icon indicating copy to clipboard operation
htmly copied to clipboard

Comment Slug

Open afoster1955 opened this issue 1 year ago • 13 comments
trafficstars

I've been able to set up a comment form (not disqus or fb) that is working except that I can't figure out what the page-id is for the posted articles. I have it set up where the url looks like this https://www.myhtmlysite.com/post/name-of-article

Can anyone five me some ideas on how to find the page id so that each article will have its own comments? I am attaching a screenshot of the comment form that will be used.

Thanks. commentform

afoster1955 avatar Dec 09 '23 16:12 afoster1955

Don't have a solution for you, but did you develop the comment form yourself? Is source code available somewhere?

bttrx avatar Dec 09 '23 17:12 bttrx

No, I did not develop it on my own and the source code is located here. https://github.com/CGrassin/interact_php Let me know if you can figure it out.

afoster1955 avatar Dec 09 '23 18:12 afoster1955

Currently htmly only use the post filename path as the ID, you can access it using $p->file so use it as the key. Please note the filename path will changed if we edit the slug, tag, category, and date. Solutions for this in popular posts:

        if ($oldfile != $newfile) {
            if (file_exists($viewsFile)) {
                $views = json_decode(file_get_contents($viewsFile), true);
                $arr = replace_key($views, $oldfile, $newfile);
                file_put_contents($viewsFile, json_encode($arr, JSON_UNESCAPED_UNICODE));                
            }
        } 

danpros avatar Dec 09 '23 23:12 danpros

Using $p->file is not working unless I misunderstand your response. Just to make sure, the comments code should be placed in the post.html.php file of each theme, correct? Since I am using the blog theme, I am entering the comments code in the post,html.php file of the blog theme.

As for the other code you provided, it is unfortunately over my head.

afoster1955 avatar Dec 10 '23 02:12 afoster1955

From the project readme.

    \Interact_PHP\Interact_PHP("<some-id-such-as-article-title>"); 

danpros avatar Dec 10 '23 12:12 danpros

I have the code set up as follows:

\Interact_PHP\Interact_PHP("<$p->file>");

But that does not work. I am also trying to confirm that the code above should be placed in the post.html.php file.

afoster1955 avatar Dec 10 '23 15:12 afoster1955

Yes it should placed in post.html.php. Try check the PHP error log to find the problems

danpros avatar Dec 10 '23 16:12 danpros

Thanks...there are no errors in the log but at least I know I have placed the code in the right place. I will keep trying to see if I can get it to work.

afoster1955 avatar Dec 10 '23 16:12 afoster1955

After upgrading to version 2.8.7 of HTMLy and using $p->file as the file id, the comments system seems to be working. I will re-post if something happens where it is not working, but for the moment, all is well.

afoster1955 avatar Dec 12 '23 00:12 afoster1955

It will be better using the $p->url with /post/ type slug because as long as the slug never changed it always has the same format.

danpros avatar Dec 12 '23 10:12 danpros

Well, I take it all back...it is now not working with $p->file nor /post/$p->url and the comments that were posted yesterday are no longer visible. I have run out of ideas on how to make a comment system to work with HTMLy if it is not Disqus or Facebook.

afoster1955 avatar Dec 12 '23 18:12 afoster1955

I think I finally found the comment system that will work with HTMLy. It is called Hashover and I'm using version 1.02 of the application, but I just noticed that there is a version 2.0 (developer) version that I will try. It is easy to set up and worked right out of the box.

afoster1955 avatar Dec 14 '23 05:12 afoster1955

Currently htmly only use the post filename path as the ID, you can access it using $p->file so use it as the key. Please note the filename path will changed if we edit the slug, tag, category, and date. Solutions for this in popular posts:

        if ($oldfile != $newfile) {
            if (file_exists($viewsFile)) {
                $views = json_decode(file_get_contents($viewsFile), true);
                $arr = replace_key($views, $oldfile, $newfile);
                file_put_contents($viewsFile, json_encode($arr, JSON_UNESCAPED_UNICODE));                
            }
        } 

What to do with that information if already using the latest HTMLy version?

@afoster1955 Please fix your links to https://github.com/CGrassin/interact_php and https://www.barkdull.org/software/hashover. Clicking

bttrx avatar Dec 23 '23 17:12 bttrx

So, anything on this? I wish for HTMLy as commenting option in itself, and not via a 3rd party.

vdbhb59 avatar May 19 '24 17:05 vdbhb59

Finally...I have been able to get a third party comment system to work with HTMLy. It is called Commentics and with the help of its developer, I have been able to get it to work on my HTMLy blog.

Once you have installed Commentics, post the following in the post.html.php file beginning on line 62 (in my file). Since I am using Commentics in two different blogs, this one is set up as an iFrame. You will have to see the Commentics documentation to see what I am talking about. Here is the code you need to enter.

            <script>
            var commentics_config = {
                'identifier': '<?php echo $p->url; ?>',
                'reference' : '<?php echo $p->title;?>'
            };
            </script>
            <div id="commentics"></div>

Good luck and let me know if you have any questions.

afoster1955 avatar May 28 '24 23:05 afoster1955

@afoster1955 for PHP integration read #747

Already added it to the docs: Commentics PHP Integration

danpros avatar May 29 '24 00:05 danpros

Excellent

afoster1955 avatar May 29 '24 00:05 afoster1955

@danpros

My 2 cents: Commentics requires a MySQL database, while HTMLy uses flat files. That doesn't fit for me.

HTMLy should include a flat-file based comment system. Even a simple one (e. g., no threading) would be better than nothing. From my point of view, comments are like blog posts, but from visitors.

My feature wish list:

  • Markdown formatting, because it's already included in HTMLy core
  • CAPTCHA support, e. g., math, graphical, or more simple: http://svardos.org/?p=forum&action=newthread#formularz
  • moderation, i.e., new comments will only be shown after admin approval
  • RSS comments feed to allow users to be notified about replies to their comment
  • (optional) email subscription

bttrx avatar Jun 01 '24 12:06 bttrx

@afoster1955 for PHP integration read #747

Already added it to the docs: Commentics PHP Integration

How about hosting the docs at GitHub, so others could contribute to via PRs? Or enabling the wiki component here and move existing content to?

bttrx avatar Jun 01 '24 12:06 bttrx

@bttrx exactly what I tried explaining earlier as well. Plus, I too wish to contribute to the wiki of the fav and only blog engine I use. :)

vdbhb59 avatar Jun 01 '24 15:06 vdbhb59

@bttrx OK noted. No ETA but I will look into it. At the moment we can look at third party solutions and integrate them into htmly.

Regarding the docs I already upload it to Github: https://github.com/danpros/htmly-docs

danpros avatar Jun 02 '24 00:06 danpros