Search results returning comment pages

I am using the Kirby Comments plugin by Addpixel; so far I love this plugin; thank you so much for building it! I have a question, though (also I have added it as a Github issue.)

I’d like to make it so each comment’s folder does not prepend with the comment number, so that the folder is invisible in Kirby. I can figure out how to change the comment folder’s number to being prepended by date (in the comments.yml blueprint). But I need to set the folders to having no number at the front, and thereby being invisible.

Where/how can this change be made?

The reason I need to make this change is that when I use the Kirby search, it is returning Comments as search results (each as their own page). If I can get the comments to be invisible, I can hopefully keep them out of the search results with ->visible() (as described at the very bottom of the Kirby search tutorial).

@gerritvanaaken Wondering if you would know, since you had originally posted about the Kirby Comments plugin I am using?

Thank you so much!

No need to make comment pages invisible. You can filter out those comment pages from your search using not() or filterBy('template'):

<?php
$site->index()->visible()->filterBy('template', '!=', 'comment')->search('q');

While this particular problem can be solved by filtering out all pages with the comment template, I am still going to add an option, so that comment pages are not prefixed with an index number. Such an option will be handy whenever a similar problem arises, but filtering by template isn’t possible.

For updates on this have a look at the GitHub issue.

I agree, apart from that, it can also be used to moderate comments, i.e. only make them visible manually… (which does not help with the problem above, though, where you would have to filter again)

1 Like