In my migration from wordpress, I’ve set up my test environment.
I’m using the “Blog Site” skeleton (and to be honest, no matter how much googling I’ve done I still don’t know what skeleton means and why someone would choose that versus a whole theme).
title: 'Using NX and Tail Number Sizes'
lang: false
comments:
- { text: 'This is a reply to the first comment.', date: 1684726981, author: DJ, email: myemail, approved: 1, answer: 1684477488 }
This is where my inexperience plagues me. I’m sure the fix is simple, but I can’t figure out why the reply isn’t being displayed. I’ve mirrored the test site on my MAMP and the same thing is happening so it’s probably a template issue. Any input is greatly valued. I’m not giving up.
Added {% if config.plugins.bettercomments.enabled %} {% include 'partials/bettercomments.html.twig' %} {% endif %} at the bottom of /user/themes/quark/templates/partials/blog-item.html.twig
There’s one major difference between our results. Your comments and replies are being created in a single file. Mine are not.
The first comment gets created here:
`user/data/comments/filename.yaml`
The reply comment gets created here:
`user/data/comments/blog/filename.yaml`
So in addition to the files being created in different locations, they’re both formatted very differently.
The first comment yaml file looks like this:
title: 'Post Title'
lang: false
comments:
-
text: 'This is the first comment.'
date: 1684477488
author: Dorian
email: myemail
approved: 1
answer: 0
The reply comment yaml file looks like this:
title: 'Post Title'
lang: false
comments:
- { text: 'This is a reply to the first comment.', date: 1684726981, author: DJ, email: myemail, approved: 1, answer: 1684477488 }
PS: Thanks for the google skeleton definition, though I still don’t know why someone would use a skeleton rather than a full theme. Just not able to wrap my head around that.
Sometimes Google is not one’s best friend. Maybe you’ve overlooked the introduction text on the Skeleton Downloads page which quite clearly explains what a Grav skeleton is:
A Grav skeleton is an all-in-one package containing the core Grav system plus sample pages, plugins, configuration. These packages are a great way to get started with Grav.
Simply download the ZIP file, extract it in your web-root, and you are ready to start using Grav!
When asked, ChatGPT amongst other things describes a Grav skeleton like so:
Using a Grav skeleton allows you to quickly set up a website without starting from scratch. It saves time by providing a solid starting point with essential files and configurations already in place. It also serves as a learning resource, demonstrating best practices and offering examples of how different components of a Grav site can be structured and organized.
Not a bad description at all I would say. Besides if you do a search on this forum you’ll get over 50 results about “skeleton”. Of course not all are great learning resources but together these posts will also help you get a better understanding of skeletons and Grav in general.
I set everything up according to the instructions.
I just deleted the plugin and reinstalled it and the same thing is happening. The first comment gets created at user/data/comments/file.yaml and the reply via the admin gets created at user/data/comments/blog/file.yaml and only the original comments get displayed on the page. Everything that is replied to via the admin do not get displayed on the page.
It’s not making any sense.
Could this in any way be caused by using a skeleton rather than a theme?
Could this in any way be caused by using a skeleton rather than a theme?
That doesn’t make sense because I’ve shown in my steps that I’m using the Site-Blog skeleton.
I also see that you’re using the plugin on the root page of the blog. Please try to add the plugin to the template of a blog item instead. In Quark, that would be /user/themes/quark/templates/partials/blog-item.html.twig
I set everything up according to the instructions.
I’ve suggested to repeat my steps, not the steps mentioned in the README of the plugin. What happens when you follow the instructions I’ve mentioned?
I’ve followed your steps and continue to get the exact same results.
I removed {% include 'partials/bettercomments.html.twig' %} from user/themes/quark/templates/item.html.twig
and added {% if config.plugins.bettercomments.enabled %} {% include 'partials/bettercomments.html.twig' %} {% endif %} to the bottom of user/themes/quark/templates/partials/blog-item.html.twig
The same things happens.
Any comment that is created via the website creates a file here user/data/comments/filename.yaml
and those comments will display on the page.
Any comment that is created via the admin creates a file here user/data/comments/blog/filename.yaml
and those comments don’t get displayed.
At this point, the only thing I think I’ve done different than you was to install the plugin via the admin whereas you installed it via the command line.
FWIW
all of my pages have been created in user/pages/01.blog and use item.md
the site’s home page is set to that “01.blog” directory
Good news! I discovered the problem, but unfortunately I don’t know how to fix it and have “clean” URLs like my wordpress site.
This entire issue is caused by the site admin configuration option “Hide Home Route in URLs” being set to YES.
When it’s enabled, then the site URLs look like yoursite/page-name
(which is what I want)
When it’s disabled, then the site URLs look like yoursite/blog/page-name
(which is what I don’t want)
This explains why comments being made on your (pamtbaau’s) test site were put it in a comments/blog directory, whereas for my setup it was putting everything created on the front end in the comments directory and everything created via the admin in the comments/blog directory.
So, does anyone have a solution that would allow me to have URLs that look like mysite/page-nameAND work with the Bettercomments plugin?
@Alpha, The issue is caused by the plugin. Its javascript running in Admin (user/plugins/bettercomments/admin/assets/bettercomments.js) uses a hardcoded '/blog/' on line 61 to prefix the filename to be used for the answer.
NB. It’s useful to share any issue created on a repo with the community. This allows anyone to follow the outcome of this post in the issue.
Also if I had known about the issue prior to my research, it would have saved me the trouble. In general, it is not really appreciated if a question is asked in multiple locations (eg. forum and github).
Lastly, it would be kind to the developer of the plugin, if you could provide a succinct summary of the problem instead of forcing the developer to dig through a thread of 14 posts to figure out what the issue is.
I didn’t know what I was doing was wrong. I asked the plugin author if he could provide some input over here and provided him a link to the post that I thought would most accurately help him understand the scenario. It never occurred to me that it would be necessary to let the group here on these forums know that I reached out to him. I don’t know what to say. Sorry. I’m totally new to grav and github and didn’t think that I was doing anything that would cause problems for people especially you because you’ve been helpful. I’ll try to do better.