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

How to make each comment folder invisible automatically? #20

Closed
liaprins opened this issue May 21, 2017 · 6 comments
Closed

How to make each comment folder invisible automatically? #20

liaprins opened this issue May 21, 2017 · 6 comments

Comments

@liaprins
Copy link

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 having no number at the front and thereby being invisible.

Where/how can this change be made? Thank you so much!

@florianpircher
Copy link
Member

florianpircher commented May 21, 2017

Individual comment pages are currently visible, but their parents, comments pages, are invisible.

Currently, you can only change the naming of the comments page. The recommended way of doing this is by setting the pages.comments.dirname option in your config.php:

c::set('comments.pages.comments.dirname', 'my-custom-comments');

Making individual comments invisible is currently not supported by the plugin. If you think this would be a useful feature, please replay. Maybe a boolean option for making comments invisible?

@liaprins
Copy link
Author

liaprins commented May 21, 2017

Thanks for your quick reply!

I believe I would need a way to turn off the visibility of all individual comments' pages/folders, to make them all invisible for my purposes.

I have also made a Kirby forum question that explains the reason for why I need this (the comments are showing up as their own pages in search results using the Kirby search, and I do not want them to). I have tested by manually taking the prepended number off of individual comment folders, and it doesn't affect the comment in the UI at all: it still shows up.

For example, here I manually made comments 1 through 3 invisible, while comment 4 is visible (all still are showing up on my site):
screen shot 2017-05-21 at 6 50 43 pm

I would definitely be in favor of a way to turn off the visibility of all individual comments! Let me know if you think this is do-able? Thanks so much for your help!

@jenstornell
Copy link

In general I don't think relying on the date is a good idea. From my experience the date can be changed by the OS or some other program. I was dependent on the dates in one of my projects and suddenly all the dates was reset for some unknown reason. Prefixed with numbers is the best solution, I think.

@liaprins With that search function. You could probably make an if statement to check if the parent is a comment parent?

@florianpircher
Copy link
Member

florianpircher commented May 22, 2017

Sound like an obvious option to add to the plugin. The implementation isn’t complicated, but I have to make sure no code breaks by introducing this new behaviour.

Edit: the new option will allow to remove the index-number-prefix, not set dates. @jenstornell’s comment outlines why working with dates isn’t an ideal solution for user generated data.

florianpircher added a commit that referenced this issue May 23, 2017
Closes #20. The name of templates can now be changed (before the first comment is published) and comment page index-prefixes can now be removed.
@liaprins
Copy link
Author

liaprins commented May 24, 2017

Thank you for working on this so quickly!

However, I have added the new comments.php file to the comments/plugins folder, and have added the code to the config.php file, and am now testing by creating new comments in my UI. They all still are prepended by the number, though (when I go into the content folder and find their folders)... :(

Here is the line I added to my config.php:
c::set('pages.comment.visible', false);
as found in line 83 of the new Readme.md file.

Any ideas? Thanks so much!

@florianpircher
Copy link
Member

florianpircher commented May 24, 2017

All options are namespaced with the comments. prefix. This makes sure, that no Kirby Comments option collides with Kirby’s or other plugins configurations.

c::set('comments.OPTION_NAME', $value);

In your case:

c::set('comments.pages.comment.visible', false);

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

3 participants