Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.

Recent comments #30

Open
jenstornell opened this issue Aug 28, 2017 · 3 comments
Open

Recent comments #30

jenstornell opened this issue Aug 28, 2017 · 3 comments

Comments

@jenstornell
Copy link

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.

@florianpircher
Copy link
Member

Kirby Comments can be used together with Kirby’s cache. This has been discussed in #12.

@florianpircher
Copy link
Member

Regarding the latest 10 comments cache: do you mean the latest of all pages or the latest of the start-page?

@jenstornell
Copy link
Author

jenstornell commented Aug 28, 2017

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. :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants