Open jenstornell opened 7 years ago
Kirby Comments can be used together with Kirby’s cache. This has been discussed in #12.
Regarding the latest 10 comments cache: do you mean the latest of all pages or the latest of the start-page?
Let's say it looks like this:
about
comments
hello-about
bye-about
projects
comments
hi-projects
goodbye-projects
Then for the latest comments do something like this:
$site->getLatestComments(3);
The result on the startpage (home) will be this:
hello-about
hi-projects
bye-about
To get the 3 latest comments like this it needs to go through every page and every comment to see which comments are the latest ones.
But by using a panel hook, it can update an array/json/yaml file with data and there store the most recent comments.
If it's not a good idea to have built in, it would be possible to have as an external plugin as well, like KirbyRecentComments. A plugin for the plugin. I would probably write it if you don't. :)
When using Kirby pages as comments it could be performance heavy to show the latest 10 comments on the startpage for example. Not at first but when having 1000+ comments.
Is there some kind of comment cache? Else I have an idea for it. When a comment is created also generate a file that contains the 10 latest comments, or the urls to these.